Question

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?

Was it helpful?

Solution

I've also searched for this, but I don't think it's possible in the current version. The current "solution" is to write code that automatically adds the "\n" every few characters, based on the minimum distance between nodes (nodesep attribute, if I'm not mistaken).

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top