Different node label margin rendering in Linux and Windows

Hi, I wonder about rendering differences on Linux and Windows. Attaching two files. The same DOT file is used and -Tsvg argument is passed to dot program. The attached files are screen shots because I could not upload svg files in this forum The version is 2.38 On Windows the labels fit comfortably inside the node with given margin but on Linux the calculations of margin seems to be a little off and the whole graph is more compressed, the text goes outside of node the longer it gets. Any idea what this depends on and how to affect the rendering on Linux? Thanks Jürgen

graphviz_win.txt18.91 KB
graphviz_linux.txt19.1 KB

The most likely cause

The most likely cause probably relates to the fact that SVG is interpreted differently by different viewers. In particular, SVG is fairly lax about what font is used. You might want to start with a graph with a single node and compare the Linux and Windows SVG output to see if they are roughly the same. Another way to check it to run with -Tsvg:cairo. This embeds all of the font information in the SVG file, so the choice of font is not an issue. Of course, the file will be a good deal bigger.

If you want, please post your original graph file and the two svg outputs. (Add a .txt suffix to the svg files, or replace .svg with .txt.)


svg files

Thanks for your answer.

I tested with svg:cairo option and on Windows it changed the dark green font color to neon green. On Linux svg file was not created.

Attaching the svg files. One can see that y/height coordinates are same but x/width coordinates are smaller on Linux. 



If svg:cairo did not work on

If svg:cairo did not work on Linux, I am now guessing that your Linux version is not configured to use cairo, and may not be even using the freetype font library. That would explain what you are seeing, as without freetype, Graphviz can only roughly estimate the text sizes. It is probably underestimating, hence the actual drawing is compressed and text goes outside of the nodes.

Try running with the -v flag on Linux and post the trace. Also, run

    dot -Tpng:

(note the colon) and post what dot prints. Thanks.


By the way, the difference you see in the greens is again a function of the SVG browser, which can interpret "green" liberally. The cairo renderer interprets green as the RGB value '#00ff00' and this is what is put into the svg output. The core svg renderer leaves green as green. To see the difference, put the following into a file and point your browser at it. Note that one node uses "green" and the other uses "#00ff00".

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
<!-- Generated by graphviz version 2.39.0 (20141023.1326)
<!-- Title: %3 Pages: 1 -->
<svg width="134pt" height="44pt"
 viewBox="0.00 0.00 134.00 44.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 40)">
<polygon fill="white" stroke="none" points="-4,4 -4,-40 130,-40 130,4 -4,4"/>
<!-- abc -->
<g id="node1" class="node"><title>abc</title>
<ellipse fill="green" stroke="black" cx="27" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-14.3" font-family="Times,serif" font-size="14.00">abc</text>
<!-- def -->
<g id="node2" class="node"><title>def</title>
<ellipse fill="#00ff00" stroke="black" cx="99" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-14.3" font-family="Times,serif" font-size="14.00">def</text>



Hi, this is the trace with


this is the trace with -v option

dot - graphviz version 2.38.0 (20140413.2041)
libdir = "/usr/lib64/graphviz"
Activated plugin library: libgvplugin_core.so.6
Using render: svg:core
Using device: svg:svg:core
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
The plugin configuration file:
                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 xdot1.4
    loadimage   :  (lib) eps gif jpe jpeg jpg png ps svg


There is something missing in installation I suppose as textlayout is empty and png is not listed as device

-Tpng gives this:

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 svgz tk vml vmlz xdot xdot1.2 xdot1.4

On windows the trace looks this:

dot - graphviz version 2.38.0 (20140413.2041)
libdir = "C:\Program Files (x86)\Graphviz2.38\bin"
Activated plugin library: gvplugin_dot_layout.dll
Using layout: dot:dot_layout
Activated plugin library: gvplugin_core.dll
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
        C:\Program Files (x86)\Graphviz2.38\bin\config6
                was successfully loaded.
    render      :  cairo dot fig gd gdiplus map pic pov ps svg tk vml vrml xdot
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  bmp canon cmap cmapx cmapx_np dot emf emfplus eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg metafile pdf pic plain plain-ext png pov
ps ps2 svg svgz tif tiff tk vml vmlz vrml wbmp xdot xdot1.2 xdot1.4
    loadimage   :  (lib) bmp eps gd gd2 gif jpe jpeg jpg png ps svg



What happened with Linux installation? I got GraphViz on Linux installed by IT people - what can I tell them? What needs to be changed?








It's clear that Graphviz was

It's clear that Graphviz was installed with just the basics. You really want freetype, fontconfig, pangocairo and other libraries used to get better layouts. These libraries usually come on linux, so it's mostly making sure the installation is set up to use them. I've asked John Ellson to respond as to what needs to be done to get a richer installation. You may need to post what type of linux you are using as the installation process differs.

The core graphviz packages

The core graphviz packages are minimalist and probably suited only for web-servers without X11.

You should install:

          graphviz-x graphviz-plugin-x

these will give you X11 apps, and renderers based on pango, cairo.


But since this seems to be a frequent issue, I've made a change to the packaging to make "graphviz-nox" a separate package, and the obvious "graphviz" package now pulls in both -x and -nox as dependencies.   So, if you "yum update" tomorrow you should get what you want.

Thanks ! yum update did not

Thanks !

yum update did not add layouts nor devices

installing graphviz-plugins-x however did and the problem is solved

Best regards



The core graphviz packages

(comment deleted)

Recent comments