The Graphviz output of octagon-shaped nodes has huge margins, even we set "margin=0.0,0.0".
Example:
digraph G {
foo [shape=octagon, label="one\ntwo", margin="0.0,0.0"];
}
Produces:
I want to have smaller margins than those, with the letter edges close to the diagonal edges of octagon. Can I do that?
simple answer: not easily. you are encountering two issues:
more complex: here is an improvement, but it is a (repeatable) kludge. It does graph layout & octagon sizing using a small font, then resets the fontsize to correct (desired) value. It uses gvpr (http://www.graphviz.org/pdf/gvpr.1.pdf) and neato -n2
(http://www.graphviz.org/faq/#FaqDotWithCoords)
dot myfile.gv |
gvpr -c 'N[shape=="octagon"]{$.fixedsize="true"; $.fontsize=$.fontsize + 3;}' | neato -n2 -Tpng >myfile.png
A modified version of "one two" (with reduced height & width):
digraph G {
foo [fontsize=11 height=.4 width=.6 fixedsize=true shape=octagon label="one\ntwo"]
}
And a larger input file:
graph Y{
rankdir=LR
label="simple octagon"
aeiou
onemore [shape=rect]
node[fontsize=11]
foo1 [shape=octagon, label="ab\na"]
foo3 [shape=octagon, label="abcd\nabc"]
foo5 [shape=octagon, label="abcdef\nabcde"]
foo7 [shape=octagon, label="abcdefgh\nabcdefg"]
foo9 [shape=octagon, label="abcdefghij\nabcdefghi"]
foo11 [shape=octagon, label="abcdefghijkl\nabcdefghijk"]
foo13 [shape=octagon, label="abcdefghijklmn\nabcdefghijklm"]
foo15 [shape=octagon, label="abcdefghijklmnop\nabcdefghijklmno"]
foo17 [shape=octagon, label="abcdefghijklmnopqr\nabcdefghijklmnopq"]
foo19 [shape=octagon, label="abcdefghijklmnopqrst\nabcdefghijklmnopqrs"]
}