how to change font size in a dot rendering

i'm using dot something like this: dot -Tpng -omyfile.png myfile.gv The .gv file has fontnames and fontsizes at the graph and node level. I've tried to change the fontsize (from 30 to 60) at all levels where it is defined. However, dot does not seem to take recognition of this: the fontsize (and therefore, node box size) stay unchanged. The problem is that I have some very large graphs for which the node text is too small to be readable. I am therefore trying to increase the text fontsize. Can someone tell me how to do this, please? Thanks kl123


the graphs in the two attached files seem to be producing the same sized font in rendering


font30.txt73.67 KB
font60.txt73.67 KB

You can set the fontsize and

You can set the fontsize and fontname at the node level:


or specify it as a global attribute, in which case, all nodes after this get this fontsize until the default is changed again:


If you are doing this and still not seeing a change in font size, please post your graph so we can take a look at it.

Changing the font size is

Changing the font size is working. With fontsize=30, you get a drawing that is roughly 425in x 66in. With fontsize=60, the drawing is about 700in x 100in. The problem arises because of the attribute size ="30,40". This causes both drawings to be scaled down to fit the smaller size. The larger drawing will be scaled down by roughly a factor of two more than the smaller drawing, so the resulting text and box sizes will be roughly the same in both final drawings.

I'd like to get a drawing of

I'd like to get a drawing of reasonable size to pan and zoom around the screen - and in which the fonts are legible. I'm struggling to see how this can be done. It seems like if the fonts are legible, the drawing is very large....and if I reduce the drawing size, the fonts become too small. When I move from 30 to 60, does the new drawing magnify uniformly? Or does it magnify only the boxes around the nodes and attempt to fit the edges around all this?  Thanks ---- kl123

Going from 30 to 60 roughly

Going from 30 to 60 roughly doubles the width of the boxes. The width of the drawing is maximum width of a rank, which is the sum of the widths of the nodes in the rank plus (n-1)*nodesep, where there are n nodes in the rank. So the boxes get bigger, but the space between boxes stays the same. You could try reducing nodesep.

In general, there are no silver bullets for handling large graphs. If the text is legible, you either have a tightly compacted drawing which takes up minimal space but the edges are so crammed in you can't see the topology, or the graph is drawn nicely but the drawing is large.

One approach that works reasonably well is the one you mentioned: allow the user to pan and zoom. Just produce the drawing with basic settings and let the user view it in an environment with pan and zoom. When zoomed out, the overall structure of the graph is visible, but the user can zoom in on particular areas to read the details. The easiest way to do this is to produce non-bitmap output such as pdf or svg. Then the usual pdf or svg viewers give you pan and zoom for free, and since these are vector graphics formats, the quality of the view remains the same no matter how far in the user zooms.

For your particular graph, there are couple of other tricks which could help. First, a lot of the space and complexity of the drawing in due to the many edge labels, which are treated a pseudo-nodes. You could replace the edge labels by xlabels and set decorate=true. Perhaps even better would be to make the edge labels transient. That is, change the edge labels to tooltips and produce svg output. Then you get a nice drawing, but the user only sees the edge labels if the mouse hovers over the edge.

Your graph also has a lot of multiedge and parallel edges. You could consider coalescing the multiedges into a single edge. For the parallel edges (edges that share much the same path), you could try setting concentrate=true.

Recent comments