Automatic multiline labels in Graphviz

graphviz

I'm using Graphviz to draw some graphs. I'm using labels on nodes and I can put in "\n" to force it to split the label across 2 lines. Is there some way to get Graphviz (or dot which I'm using) to automatically see that it should split some nodes labels, and for it itself to make the best choice automagically?

Best Answer

Yes, HTML-like labels (<...>) support
tag, using which you can break the lines. E.g.

"A" -> "B"
[label = <1. <br/>
 2. <br/>
 3. <br/>
 4. <br/>
 .... <br/> 
> color="blue" style="dashed"];

These also work when embedding Graphviz in LaTeX, where \n would not.

Related Topic