Graphviz does not display SVG images - graphviz

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,

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

Related

"failed to execute PosixPath('dot'), make sure the Graphviz executables are on your systems" PATH on mac in sage math

I want to use graphviz for graph vizualisation. I would like to use source from graphviz:
def display(self, verbose=False):
'''
Prints the QMDD as a dot graph.
'''
filename = '.tmp.dot'
self.save_as_dot(filename, verbose)
s = Source.from_file(filename)
s.view()
os.remove(filename)
# Can't manage to properly remove file .tmp.dot.pdf
I always experience this error message :
""failed to execute PosixPath('dot'), make sure the Graphviz executables are on your systems' PATH.""
I'm using a mac and a sage math in a jupyter notebook.
I've already tried to do pip3 install graphviz and brew install graphviz. Furthermore I had the path : "/Library/SageMath/local/lib/python3.9/site-packages/graphviz" to the system path but each solutions didn't work.
Try this:
conda install python-graphviz
It worked for me!

Does GraphVIz for Mac has sfdp laying?

I installed GraphViz 2.36 from MacPorts. I have to process hundreds of nodes and don't need hierarchy, just a readable graph. But GUI does not allow to choose laying. I tried to run this:
sfdp -Goverlap=prism -Tpng test.gv > test.png
But I get:
Warning: Overlap value "prism" unsupported - ignored
Error: remove_overlap: Graphviz not built with triangulation library
and a lot of exceptions of invalid context 0x0. What can be done here?..
I have solved it. Firstly, I updated to 2.38 from MacPorts. Secondly, I found a simple way to make a beautiful graph without additional console attributes:
digraph MyGraph {
graph [layout="sfdp", overlap="prism"];
...
}

Graphviz seems doesn't support png and map

Hi I must convert a graph (a .dot) to a map and to a png because I must generate dependencies graph with doxygen using graphviz. But I have a error:
error: problems opening map file
If I do dot -v I have
dot - graphviz version 2.38.0 (20140413.2041)
libdir = "/usr/local/lib/graphviz"
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
Activated plugin library: libgvplugin_core.so.6
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
/usr/local/lib/graphviz/config6
was successfully loaded.
render : dot fig map pic pov ps svg tk vml xdot
layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp
twopi
textlayout :
device : canon cmap cmapx cmapx_np dot eps fig gv imap imap_np ismap
pic plain plain-ext pov ps ps2 svg svgz tk vml vmlz xdot xdot1.2
loadimage : (lib) eps gif jpe jpeg jpg png ps svg
There isn't map and png for render
Moreover if I do dot -Tpng
Format: "png" not recognized. Use one of: canon cmap cmapx cmapx_np
dot eps fig gv imap imap_np ismap pic plain plain-ext pov ps ps2 svg
tk vml vmlz xdot xdot1.2 xdot1.4
It seem that I have not the library for png and map.
How can I fix the problem?
(I do not remember how at the time I installed grapghviz)
(I'm working on Linux SO)
Graphviz plugins need to be registered before they can be used. In Windows, open the command prompt as admin and type dot -c to register. You can verify it by typing dot -v
I had the same problem on Centos 7 and I was able to solve it by
installing the graphviz-gd package with the command yum install graphviz-gd
After the installation I executed dot -c and now dot -v shows the following devices:
canon cmap cmapx cmapx_np dot eps fig gd gd2
gif gv imap imap_np ismap jpe jpeg jpg pic plain
plain-ext png pov ps ps2 svg svgz tk vml vmlz
vrml wbmp xdot xdot1.2 xdot1.4
Moreover I use the cmapx to create the map file.
Regards,
nemo
I had same issue on macos 10.14. Solved the issue by reinstalling graphviz, and somehow it says 'not linked' as following
Warning: graphviz 2.47.3 is already installed, it's just not linked. To link this version, run: brew link graphviz
So end up with the following two commands:
brew install -f -s graphviz
brew link --overwrite graphviz

pdfcairo 'unknown or ambiguous terminal type' in gnuplot

After upgrading gnuplot from 4.6 to 5.0.1, I encounter the following error:
set terminal pdfcairo size 3.0in,2.25in font ',8'
^
"plot.plt", line 114: unknown or ambiguous terminal type; type just 'set terminal' for a list
How can I fix it?
PS: pdfcairo works fine in the previous version (4.6).
I install the gnuplot by the following command:
#build it:
./configure --with-cairo
make
#install it:
sudo make install
As described in GNUPLOT Version 5.0.1 Release Notes, the pdfcairo is included by default.
Cairo/pango/wxWidgets This set of terminals includes
pngcairo, pdfcairo, epscairo, and cairolatex for output to a file
wxt for interactive display All of these will be built by default if the
configuration script finds the required libcairo, libpango, libcairo,
libwxgtk, and related support libraries To disable these terminals:
./configure --without-cairo ./configure --with-cairo --disable-wxt
I fix it with the kind reminder of #Christoph.
To tackle this issue, install the dependency libraries for cairo-based terminals by the follwoing command:
sudo apt-get install libcairo2-dev
sudo apt-get install libpango1.0-dev
And then compile gnuplot again:
#build it:
cd gnuplot-5.0.1 ; ./configure ; make
#install it:
sudo make install
Now, everything is fine. Enjoy it:-)
gnuplot> set term
Available terminal types:
cairolatex LaTeX picture environment using graphicx package and Cairo backend
canvas HTML Canvas object
cgm Computer Graphics Metafile
context ConTeXt with MetaFun (for PDF documents)
corel EPS format for CorelDRAW
dumb ascii art for anything that prints text
dxf dxf-file for AutoCad (default size 120x80)
eepic EEPIC -- extended LaTeX picture environment
emf Enhanced Metafile format
emtex LaTeX picture environment with emTeX specials
epscairo eps terminal based on cairo
epslatex LaTeX picture environment using graphicx package
fig FIG graphics language for XFIG graphics editor
hpgl HP7475 and relatives [number of pens] [eject]
latex LaTeX picture environment
mf Metafont plotting standard
mp MetaPost plotting standard
pcl5 HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
pdfcairo pdf terminal based on cairo
pngcairo png terminal based on cairo
postscript PostScript graphics, including EPSF embedded files (*.eps)
Press return for more:

Rmagick unable to read font

I have a piece of code that draws text on top of an image in my Rails app and since short while ago, probably having to to with upgrading to OS X Yosemite, it's having an issue with reading fonts on my local machine (production server is working fine).
I can reduce it to this example:
require 'rvg/rvg'
font = '"/Users/xxxxxxxx/xxxx/app/assets/fonts/PTSans-Regular.ttf"'
rvg = Magick::RVG.new(100,100) do |canvas|
canvas.text(0, 0, 'my text').styles(font: font)
end
rvg.draw
I get this error
Magick::ImageMagickError: unable to read font `"/Users/xxxxxxxx/xxxx/app/assets/fonts/PTSans-Regular.ttf"' # error/annotate.c/RenderFreetype/1153: `(null)'
from /Users/xxxxxxxx/.rvm/gems/ruby-2.0.0-p353#xxxxxxxx/gems/rmagick-2.13.2/lib/rvg/misc.rb:322:in `get_type_metrics'
I tried reinstalling imagemagick and the rmagick gem, also with these flags:
brew install imagemagick --disable-openmp --build-from-source
Also, if I change
font = "/Users/xxxxxx/xxxxx/app/assets/fonts/PTSans-Regular.ttf"
thinking that the extra quotes could get in the way, then I get
Magick::ImageMagickError: non-conforming drawing primitive definition `Users/xxxxx/xxxx/app/assets/fonts/PTSans-Regular.ttf' # error/draw.c/DrawImage/3170
from /Users/xxxxxxx/.rvm/gems/ruby-2.0.0-p353#xxxx/gems/rmagick-2.13.2/lib/rvg/misc.rb:546:in `draw'
I have also tried to install the latest version of XQuartz from http://xquartz.macosforge.org/landing/
Strangely enough, this fixed it:
brew install gs
The error got me confused because it didn't say anything about ghostscript, however, it worked according to https://stackoverflow.com/a/13936374/322253

Resources