HTML like lables
Typically, the label is just a string that is enclosed in quotes (label = "some text"
).
However, if angle brackes are used (
label = < <table> … >
), Graphviz renders labels
with HTML tags.
Giving a graph a title
A label that is not part of an edge or a node gives a title to a graph.
By default, this title is rendered at the graph's bottom. In order to render it on the top, the value of labelloc
needs to be set to t
.
digraph {
label = "The title of the graph"
labelloc = t // t: Place the graph's title on top.
fontsize = 30 // Make title stand out by giving a large font size
fontcolor = blue
node [ shape = rect ]
node_1 [ label = "text for a first node" ]
node_2 [ label = "text for a second node" ]
// Start label text with a space so
// it doesn't get rendered too close to the edge.
node_1 -> node_2 [ label = " label for edge"]
}