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,
7 hours 5 min ago - If you put the fixedsize
7 hours 29 min ago - If you put the fixedsize
7 hours 29 min ago - Are there some actual examples around?
9 hours 28 sec ago - There are two features
9 hours 33 min ago - There is nothing built into
9 hours 44 min ago - I was able to resolve this
1 day 12 hours ago - x11 event bindings
3 days 5 hours ago - One could probable work
3 days 6 hours ago - Would it be possible to
3 days 7 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