问题
I am trying to create a Graphviz chart with an SVG image embedded in a node, but the SVG image does not display whereas using a PNG image works fine. For example, I download this test image, and then use the following code
digraph G {
a [label=<<TABLE><TR><TD><IMG SRC="/full/path/Test.svg"/></TD></TR></TABLE>>];
a -> b;
}
Executing
dot graph.gv -Tpdf -o graph.pdf
Produces a PDF with a empty spot where Test.svg
should be. Graphviz does not report any error message. I am doing this on macOS with Graphviz 2.40.1 installed via Homebrew. I have had no better luck on Windows 7, although on Windows Graphviz reports an error, Warning: No loadimage plugin for "svg:cairo
,
回答1:
I spent hours banging away on this problem on OS X High Sierra. Finally got it working. I had to install graphviz using option --with-librsvg
:
$ brew install graphviz --with-librsvg --with-app --with-pango
来源:https://stackoverflow.com/questions/46254393/graphviz-does-not-display-svg-images