dot User’s Manual, January 26, 2006 8
Multi-line labels can be created by using the escape sequences \n, \l, \r to
terminate lines that are centered, or left or right justified.
2
Graphs and cluster subgraphs may also have labels. Graph labels appear, by
default, centered below the graph. Setting labelloc=t centers the label above
the graph. Cluster labels appear within the enclosing rectangle, in the upper left
corner. The value labelloc=b moves the label to the bottom of the rectangle.
The setting labeljust=r moves the label to the right.
The default font is 14-point Times-Roman, in black. Other font families,
sizes and colors may be selected using the attributes fontname, fontsize and
fontcolor. Font names should be compatible with the target interpreter. It is
best to use only the standard font families Times, Helvetica, Courier or Symbol
as these are guaranteed to work with any target graphics language. For example,
Times-Italic, Times-Bold, and Courier are portable; AvanteGarde-
DemiOblique isn’t.
For bitmap output, such as GIF or JPG, dot relies on having these fonts avail-
able during layout. Most precompiled installations of Graphviz use the fontconfig
library for matching font names to available fontfiles. fontconfig comes with a
set of utilities for showing matches and installing fonts. Please refer to the font-
config documentation, or the external Graphviz FontFAQ or for further details. If
Graphviz is built without fontconfig (which usually means you compiled it from
source code on your own), the fontpath attribute can specify a list of directo-
ries
3
which should be searched for the font files. If this is not set, dot will use the
DOTFONTPATH environment variable or, if this is not set, the GDFONTPATH
environment variable. If none of these is set, dot uses a built-in list.
Edge labels are positioned near the center of the edge. Usually, care is taken to
prevent the edge label from overlapping edges and nodes. It can still be difficult,
in a complex graph, to be certain which edge a label belongs to. If the decorate
attribute is set to true, a line is drawn connecting the label to its edge. Sometimes
avoiding collisions among edge labels and edges forces the drawing to be bigger
than desired. If labelfloat=true, dot does not try to prevent such overlaps,
allowing a more compact drawing.
An edge can also specify additional labels, using headlabel and taillabel,
which are be placed near the ends of the edge. The characteristics of these la-
bels are specified using the attributes labelfontname, labelfontsize and
labelfontcolor. These labels are placed near the intersection of the edge and
the node and, as such, may interfere with them. To tune a drawing, the user can set
2
The escape sequence \N is an internal symbol for node names.
3
For Unix-based systems, this is a concatenated list of pathnames, separated by colons. For
Windows-based systems, the pathnames are separated by semi-colons.