views:

33

answers:

1

Graphviz node

I'm making a graphviz neato graph, but the text in the longer labels goes outside the boundary. Does anyone know why?

Check it out yourself: http://pepijndevos.nl/cgi-bin/python/tweetograph.py/

A: 

Node size should increase to accommodate your label text--that's the default behavior for the graphviz layout algorithms, but clearly that's not what's happening here.

I have no idea what's in your code, but the only way i am aware of to opt out of this default rule is to set the node attribute "fixedsize" to "true".

So just search for this term ("fixedsize") in your code (it might be set once for all nodes near the beginning of the file or it might be set for some or all nodes individually; in either case, either delete this attribute and its value altogether or change the attribute value to "false").

[Note: if "fixedsize=true" is indeed set in your code, then it also means that you have set width and height values for some or all of your nodes. As long as you change the 'fixedsize' value to "false" you do not have to change the height and width values because with "fixedsize" set to "false", these values just set the initial minimum height and width values passed to the layout algorithm.]

If you don't want to do this (i.e., if for some reason, you want complete control over node size) then you can shrink the label to try to make it fit within the node border, like this:

node [fontsize=10]
doug
I generated the dot file myself. There is no size or location specified anywhere, just the general a -> b; stuff. This graph worked locally, but on my server all the lines and fonts look uglier. Could it be that there is a font missing? I can get you the dot file if you want to see for yourself.
Pepijn
did you try setting "fixedsize"=false (obviously this shouldn't be necessary, still...)? Missing font? Perhaps--but it shouldn't affect node resizing. Just to be sure, try setting the "fontname" as a graph attribute--select a font you are pretty sure is accessible by the server (e.g., "Helvetica" maybe?)
doug
I noticed the log contains messages telling there are missing fonts, rendering svg output works fine.
Pepijn
I asked my host where they store fonts, set the fontpath accordingly, bam! Works! http://pepijndevos.nl/cgi-bin/python/tweetograph.py/
Pepijn