Labels of the nodes in the output of dot
Submitted by shijovijayan on Wed, 06/01/2011 - 05:52
Dear sir, Is it possible to change the labels of the nodes in output of dot. If yes how? thanks in advance. shijo
Recent comments
- I like the look of the nodes,
1 day 15 hours ago - If you put the fixedsize
1 day 15 hours ago - If you put the fixedsize
1 day 15 hours ago - Are there some actual examples around?
1 day 16 hours ago - There are two features
1 day 17 hours ago - There is nothing built into
1 day 17 hours ago - I was able to resolve this
2 days 20 hours ago - x11 event bindings
4 days 13 hours ago - One could probable work
4 days 14 hours ago - Would it be possible to
4 days 15 hours ago

Text above and below nodes
How do I place a text above and below a node?
use a plaintext node rank=same as text label.
to put some text next to the b node look at this example:
digraph g{
a -> b
a [label="hello",shape=ellipse,fillcolor="burlywood",style="filled"];
b [label="graphviz",shape=box,fillcolor="palegreen",style="filled,rounded"];
b->iuc [style=dotted, arrowhead=odot, arrowsize=1] ;
iuc [shape=plaintext,label="This is a test of a long\n comment and how dot is showing\n it"];
{rank=same; b;iuc}
}
Text above and below nodes
There is no direct support for this, though there are various ways to approximate it. One way is to attach an xlabel attribute to the node (this requires a version of Graphviz later than August, 2011). This will position the label exterior to the node, avoiding overlap with other nodes and labels. Here, you don't really have control over where the node is placed. Alternatively, you can use HTML-like labels to represent your node with an apparently external label and the node proper. You also might be able to use an edge headlabel or taillabel. For example, in a dot layout, with edges pointing down, attaching a taillabel to an edge leaving a node will appear as a label beneath the node.
node labels
To change the label of a node, use the label attribute
node0 [label = "My label"]
See http://www.graphviz.org/content/attrs#alabel
Emden