Labels of the nodes in the output of dot

Dear sir, Is it possible to change the labels of the nodes in output of dot. If yes how? thanks in advance. shijo

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"]

Recent comments