2

When using dot to draw a graph, is there a way to specify the desired node label fontsize and a maximum width for the overall graph?

I tried with setting the graph size to "2.79,10000000" in order to have a image at most 2.79in wide. The default for nodes is set to a specific fontsize and a margin of "0.0,0.0".

When outputting this, dot produces a pdf that is 2.79in wide, but the fonts have been scaled down. If I correct the set fontsize by the factor my font was shrunk now, the output looks fine, i.e., my labels appear in the correct fontsize.

Is there a way to achieve the desired maximum width plus the fixed fontsize without having to manually correct the fontsize by a factor?

kaihowl
  • 372
  • 2
  • 13

1 Answers1

0

I don't think there is an easy general solution for this particular problem: The graph first gets layed out, then scaled down (including text) to fit the size requirement (see also Controlling the size).

If the text of a wide graph were to stay the same size when getting scaled down, in most cases the final width of the graph will probably stay almost the same.

For some simple graphs, you may specify the ratio in addition to the page size and make sure that the graph to generate will not be wider that the size (in order to prevent shrinking).

Community
  • 1
  • 1
marapet
  • 54,856
  • 12
  • 170
  • 184