Note that attribute names are case-sensitive. This is usually true for attribute values as well, unless noted.
All Graphviz attributes are specified by name-value pairs. Thus, to set the fillcolor of a node abc, one would use
abc [fillcolor = red] |
abc -> def [arrowhead = diamond] |
At present, most device-independent units are either inches or points, which we take as 72 points per inch.
Note: Some attributes, such as dir or arrowtail, are ambiguous when used in DOT with an undirected graph since the head and tail of an edge are meaningless. As a convention, the first time an undirected edge appears, the DOT parser will assign the left node as the tail node and the right node as the head. For example, the edge A -- B will have tail A and head B. It is the user's responsibility to handle such edges consistently. If the edge appears later, in the format
B -- A [taillabel = "tail"] |
The tools accept standard C representations for int and double types. For the bool type, TRUE values are represented by "true" or "yes" (case-insensitive) and any non-zero integer, and FALSE values by "false" or "no" (case-insensitive) and zero. In addition, there are a variety of specialized types such as arrowType, color, point and rankdir. Legal values for these types are given at the end.
In the Used By field, the characters E, N, G, S and C represent edges, nodes, the root graph, subgraphs and cluster subgraphs, respectively. This field indicates which graph component uses the attribute.
In the Notes field, an annotation of write only indicates that the attribute is used for output, and is not used or read by any of the layout programs.
Name | Used By | Type | Default | Minimum | Notes |
---|---|---|---|---|---|
Damping | G | double | 0.99 | 0.0 | neato only |
K | GC | double | 0.3 | 0 | sfdp, fdp only |
URL | ENGC | escString | <none> | svg, postscript, map only | |
_background | G | string | <none> | ||
area | NC | double | 1.0 | >0 | patchwork only |
arrowhead | E | arrowType | normal | ||
arrowsize | E | double | 1.0 | 0.0 | |
arrowtail | E | arrowType | normal | ||
bb | G | rect | write only | ||
bgcolor | GC | color
colorList | <none> | ||
center | G | bool | false | ||
charset | G | string | "UTF-8" | ||
clusterrank | G | clusterMode | local | dot only | |
color | ENC | color
colorList | black | ||
colorscheme | ENCG | string | "" | ||
comment | ENG | string | "" | ||
compound | G | bool | false | dot only | |
concentrate | G | bool | false | ||
constraint | E | bool | true | dot only | |
decorate | E | bool | false | ||
defaultdist | G | double | 1+(avg. len)*sqrt(|V|) | epsilon | neato only |
dim | G | int | 2 | 2 | sfdp, fdp, neato only |
dimen | G | int | 2 | 2 | sfdp, fdp, neato only |
dir | E | dirType | forward(directed) none(undirected) | ||
diredgeconstraints | G | string bool | false | neato only | |
distortion | N | double | 0.0 | -100.0 | |
dpi | G | double | 96.0 0.0 | svg, bitmap output only | |
edgeURL | E | escString | "" | svg, map only | |
edgehref | E | escString | "" | svg, map only | |
edgetarget | E | escString | <none> | svg, map only | |
edgetooltip | E | escString | "" | svg, cmap only | |
epsilon | G | double | .0001 * # nodes(mode == KK) .0001(mode == major) | neato only | |
esep | G | addDouble
addPoint | +3 | not dot | |
fillcolor | NEC | color
colorList | lightgrey(nodes) black(clusters) | ||
fixedsize | N | bool
string | false | ||
fontcolor | ENGC | color | black | ||
fontname | ENGC | string | "Times-Roman" | ||
fontnames | G | string | "" | svg only | |
fontpath | G | string | system-dependent | ||
fontsize | ENGC | double | 14.0 | 1.0 | |
forcelabels | G | bool | true | ||
gradientangle | NCG | int | "" | ||
group | N | string | "" | dot only | |
headURL | E | escString | "" | svg, map only | |
head_lp | E | point | write only | ||
headclip | E | bool | true | ||
headhref | E | escString | "" | svg, map only | |
headlabel | E | lblString | "" | ||
headport | E | portPos | center | ||
headtarget | E | escString | <none> | svg, map only | |
headtooltip | E | escString | "" | svg, cmap only | |
height | N | double | 0.5 | 0.02 | |
href | GCNE | escString | "" | svg, postscript, map only | |
id | GCNE | escString | "" | svg, postscript, map only | |
image | N | string | "" | ||
imagepath | G | string | "" | ||
imagepos | N | string | "mc" | ||
imagescale | N | bool
string | false | ||
inputscale | G | double | <none> | fdp, neato only | |
label | ENGC | lblString | "\N" (nodes) "" (otherwise) | ||
labelURL | E | escString | "" | svg, map only | |
label_scheme | G | int | 0 | 0 | sfdp only |
labelangle | E | double | -25.0 | -180.0 | |
labeldistance | E | double | 1.0 | 0.0 | |
labelfloat | E | bool | false | ||
labelfontcolor | E | color | black | ||
labelfontname | E | string | "Times-Roman" | ||
labelfontsize | E | double | 14.0 | 1.0 | |
labelhref | E | escString | "" | svg, map only | |
labeljust | GC | string | "c" | ||
labelloc | NGC | string | "t"(clusters) "b"(root graphs) "c"(nodes) | ||
labeltarget | E | escString | <none> | svg, map only | |
labeltooltip | E | escString | "" | svg, cmap only | |
landscape | G | bool | false | ||
layer | ENC | layerRange | "" | ||
layerlistsep | G | string | "," | ||
layers | G | layerList | "" | ||
layerselect | G | layerRange | "" | ||
layersep | G | string | " :\t" | ||
layout | G | string | "" | ||
len | E | double | 1.0(neato) 0.3(fdp) | fdp, neato only | |
levels | G | int | MAXINT | 0.0 | sfdp only |
levelsgap | G | double | 0.0 | neato only | |
lhead | E | string | "" | dot only | |
lheight | GC | double | write only | ||
lp | EGC | point | write only | ||
ltail | E | string | "" | dot only | |
lwidth | GC | double | write only | ||
margin | NCG | double point | <device-dependent> | ||
maxiter | G | int | 100 * # nodes(mode == KK) 200(mode == major) 600(fdp) | fdp, neato only | |
mclimit | G | double | 1.0 | dot only | |
mindist | G | double | 1.0 | 0.0 | circo only |
minlen | E | int | 1 | 0 | dot only |
mode | G | string | major | neato only | |
model | G | string | shortpath | neato only | |
mosek | G | bool | false | neato only | |
newrank | G | bool | false | dot only | |
nodesep | G | double | 0.25 | 0.02 | |
nojustify | GCNE | bool | false | ||
normalize | G | double bool | false | not dot | |
notranslate | G | bool | false | neato only | |
nslimit
nslimit1 | G | double | dot only | ||
ordering | GN | string | "" | dot only | |
orientation | N | double | 0.0 | 360.0 | |
orientation | G | string | "" | ||
outputorder | G | outputMode | breadthfirst | ||
overlap | G | string bool | true | not dot | |
overlap_scaling | G | double | -4 | -1.0e10 | prism only |
overlap_shrink | G | bool | true | prism only | |
pack | G | bool
int | false | ||
packmode | G | packMode | node | ||
pad | G | double point | 0.0555 (4 points) | ||
page | G | double point | |||
pagedir | G | pagedir | BL | ||
pencolor | C | color | black | ||
penwidth | CNE | double | 1.0 | 0.0 | |
peripheries | NC | int | shape default(nodes) 1(clusters) | 0 | |
pin | N | bool | false | fdp, neato only | |
pos | EN | point
splineType | |||
quadtree | G | quadType
bool | normal | sfdp only | |
quantum | G | double | 0.0 | 0.0 | |
rank | S | rankType | dot only | ||
rankdir | G | rankdir | TB | dot only | |
ranksep | G | double doubleList | 0.5(dot) 1.0(twopi) | 0.02 | twopi, dot only |
ratio | G | double string | |||
rects | N | rect | write only | ||
regular | N | bool | false | ||
remincross | G | bool | true | dot only | |
repulsiveforce | G | double | 1.0 | 0.0 | sfdp only |
resolution | G | double | 96.0 0.0 | svg, bitmap output only | |
root | GN | string bool | <none>(graphs) false(nodes) | circo, twopi only | |
rotate | G | int | 0 | ||
rotation | G | double | 0 | sfdp only | |
samehead | E | string | "" | dot only | |
sametail | E | string | "" | dot only | |
samplepoints | N | int | 8(output) 20(overlap and image maps) | ||
scale | G | double point | not dot | ||
searchsize | G | int | 30 | dot only | |
sep | G | addDouble
addPoint | +4 | not dot | |
shape | N | shape | ellipse | ||
shapefile | N | string | "" | ||
showboxes | ENG | int | 0 | 0 | dot only |
sides | N | int | 4 | 0 | |
size | G | double point | |||
skew | N | double | 0.0 | -100.0 | |
smoothing | G | smoothType | "none" | sfdp only | |
sortv | GCN | int | 0 | 0 | |
splines | G | bool
string | |||
start | G | startType | "" | fdp, neato only | |
style | ENCG | style | "" | ||
stylesheet | G | string | "" | svg only | |
tailURL | E | escString | "" | svg, map only | |
tail_lp | E | point | write only | ||
tailclip | E | bool | true | ||
tailhref | E | escString | "" | svg, map only | |
taillabel | E | lblString | "" | ||
tailport | E | portPos | center | ||
tailtarget | E | escString | <none> | svg, map only | |
tailtooltip | E | escString | "" | svg, cmap only | |
target | ENGC | escString
string | <none> | svg, map only | |
tooltip | NEC | escString | "" | svg, cmap only | |
truecolor | G | bool | bitmap output only | ||
vertices | N | pointList | write only | ||
viewport | G | viewPort | "" | ||
voro_margin | G | double | 0.05 | 0.0 | not dot |
weight | E | int double | 1 | 0(dot,twopi) 1(neato,fdp) | |
width | N | double | 0.75 | 0.01 | |
xdotversion | G | string | xdot only | ||
xlabel | EN | lblString | "" | ||
xlp | NE | point | write only | ||
z | N | double | 0.0 | -MAXFLOAT -1000 |
For svg, cmapx and imap output, the active area for a node is its visible image. For example, an unfilled node with no drawn boundary will only be active on its label. For other output, the active area is its bounding box. The active area for a cluster is its bounding box. For edges, the active areas are small circles where the edge contacts its head and tail nodes. In addition, for svg, cmapx and imap, the active area includes a thin polygon approximating the edge. The circles may overlap the related node, and the edge URL dominates. If the edge has a label, this will also be active. Finally, if the edge has a head or tail label, this will also be active.
Note that, for edges, the attributes headURL, tailURL, labelURL and edgeURL allow control of various parts of an edge. Also note that, if active areas of two edges overlap, it is unspecified which area dominates.
If the value is a colorList, a gradient fill is used. By default, this is a linear fill; setting style=radial will cause a radial fill. At present, only two colors are used. If the second color (after a colon) is missing, the default color is used for it. See also the gradientangle attribute for setting the gradient angle.
For certain output formats, such as PostScript, no fill is done for the root graph unless bgcolor is explicitly set. For bitmap formats, however, the bits need to be initialized to something, so the canvas is filled with white by default. This means that if the bitmap output is included in some other document, all of the bits within the bitmap's bounding box will be set, overwriting whatever color or graphics were already on the page. If this effect is not desired, and you only want to set bits explicitly assigned in drawing the graph, set bgcolor="transparent".
For edges, the value can either be a single color or a colorList. In the latter case, if colorList has no fractions, the edge is drawn using parallel splines or lines, one for each color in the list, in the order given. The head arrow, if any, is drawn using the first color in the list, and the tail arrow, if any, the second color. This supports the common case of drawing opposing edges, but using parallel splines instead of separately routed multiedges. If any fraction is used, the colors are drawn in series, with each color being given roughly its specified fraction of the edge. For example, the graph
digraph G { a -> b [dir=both color="red:blue"] c -> d [dir=none color="green:red;0.25:blue"] }yields
digraph G { a -> c; a -> b; b -> c [constraint=false]; }the edge
b -> c
does not add a constraint during rank
assignment, so the only constraints are that a be above b and c,
yielding the graph:Note that, at present, all aspects of rendering are 2D. This includes the shape and size of nodes, overlap removal, and edge routing. Thus, for dimen > 2, the only valid information is the pos attribute of the nodes. All other coordinates will be 2D and, at best, will reflect a projection of a higher-dimensional point onto the plane.
If the value is a colorList, a gradient fill is used. By default, this is a linear fill; setting style=radial will cause a radial fill. At present, only two colors are used. If the second color (after a colon) is missing, the default color is used for it. See also the gradientangle attribute for setting the gradient angle.
Note that a cluster inherits the root graph's attributes if defined. Thus, if the root graph has defined a fillcolor, this will override a color or bgcolor attribute set for the cluster.
If true, the node size is specified by the values of the width and height attributes only and is not expanded to contain the text label. There will be a warning if the label (with margin) cannot fit within these limits.
If the fixedsize attribute is set to shape, the width and height attributes also determine the size of the node shape, but the label can be much larger. Both the label and shape sizes are used when avoiding node overlap, but all edges to the node ignore the label and only contact the node shape. No warning is given if the label is too large.
How font names are resolved also depends on the underlying library that handles font name resolution. If Graphviz was built using the fontconfig library, the latter library will be used to search for the font. See the commands fc-list, fc-match and the other fontconfig commands for how names are resolved and which fonts are available. Other systems may provide their own font package, such as Quartz for OS X.
Note that various font attributes, such as weight and slant, can be built into the font name. Unfortunately, the syntax varies depending on which font system is dominant. Thus, using fontname="times bold italic" will produce a bold, slanted Times font using Pango, the usual main font library. Alternatively, fontname="times:italic" will produce a slanted Times font from fontconfig, while fontname="times-bold" will resolve to a bold Times using Quartz. You will need to ascertain which package is used by your Graphviz system and refer to the relevant documentation.
If Graphviz is not built with a high-level font library, fontname will be considered the name of a Type 1 or True Type font file. If you specify fontname=schlbk, the tool will look for a file named schlbk.ttf or schlbk.pfa or schlbk.pfb in one of the directories specified by the fontpath attribute. The lookup does support various aliases for the common fonts.
If unset, the default angle is 0.
If the node shape is regular, the width and height are made identical. In this case, if either the width or the height is set explicitly, that value is used. In this case, if both the width or the height are set explicitly, the maximum of the two values is used. If neither is set explicitly, the minimum of the two default values is used.
If the graph provides an id attribute, this will be used as a prefix for internally generated attributes. By making these distinct, the user can include multiple image maps in the same document.
The file must contain the image size information. This is usually trivially true for the bitmap formats. For PostScript, the file must contain a line starting with %%BoundingBox: followed by four integers specifying the lower left x and y coordinates and the upper right x and y coordinates of the bounding box for the image, the coordinates being in points. An SVG image file must contain width and height attributes, typically as part of the svg element. The values for these should have the form of a floating point number, followed by optional units, e.g., width="76pt". Recognized units are in, px, pc, pt, cm and mm for inches, pixels, picas, points, centimeters and millimeters, respectively. The default unit is points.
Unlike with the shapefile attribute, the image is treated as node content rather than the entire node. In particular, an image can be contained in a node of any shape, not just a rectangle.
tl | Top Left |
tc | Top Centered |
tr | Top Right |
ml | Middle Left |
mc | Middle Centered (the default) |
mr | Middle Right |
bl | Bottom Left |
bc | Bottom Centered |
br | Bottom Right |
During rendering, in the default case (imagescale=false), the image retains its natural size. If imagescale=true, the image is uniformly scaled (i.e., its aspect ratio is preserved) to fit inside the node. At least one dimension of the image will be as large as possible given the size of the node. When imagescale=width, the width of the image is scaled to fill the node width. The corresponding property holds when imagescale=height. When imagescale=both, both the height and the width are scaled separately to fill the node.
In all cases, if a dimension of the image is larger than the corresponding dimension of the node, that dimension of the image is scaled down to fit the node. As with the case of expansion, if imagescale=true, width and height are scaled uniformly.
If not set, no scaling is done and the units on input are treated as inches. A value of 0 is equivalent to inputscale=72.
Note that a node's default label is "\N", so the node's name or ID becomes its label. Technically, a node's name can be an HTML string but this will not mean that the node's label will be interpreted as an HTML-like label. This is because the node's actual label is an ordinary string, which will be replaced by the raw bytes stored in the node's name. To get an HTML-like label, the label attribute value itself must be an HTML string.
The angle, in degrees, specifies the rotation from the 0 degree ray, with positive angles moving counterclockwise and negative angles moving clockwise.
For graphs and clusters, only "t" and "b" are allowed, corresponding to placement at the top and bottom, respectively. By default, root graph labels go on the bottom and cluster labels go on the top. Note that a subgraph inherits attributes from its parent. Thus, if the root graph sets labelloc to "b", the subgraph inherits this value.
For nodes, this attribute is used only when the height of the node is larger than the height of its label. If labelloc is set to "t", "c", or "b", the label is aligned with the top, centered, or aligned with the bottom of the node, respectively. In the default case, the label is vertically centered.
This attribute takes precedence over the -K flag or the actual command name used.
Note that the margin is not part of the drawing but just empty space left around the drawing. It basically corresponds to a translation of drawing, as would be necessary to center a drawing on a page. Nothing is actually drawn in the margin. To actually extend the background of a drawing, see the pad attribute.
For clusters, this specifies the space between the nodes in the cluster and the cluster bounding box. By default, this is 8 points.
For nodes, this attribute specifies space left around the node's label. By default, the value is 0.11,0.055.
There are two experimental modes in neato, "hier", which adds a top-down directionality similar to the layout used in dot, and "ipsep", which allows the graph to specify minimum vertical and horizontal distances between nodes. (See the sep attribute.)
For sfdp, the default mode is "spring", which corresponds to using a spring-electrical model. Setting mode to "maxent" causes a similar model to be run but one that also takes into account edge lengths specified by the "len" attribute.
For more control of distances, one can use model=mds. In this case, the len of an edge is used as the ideal distance between its vertices. A shortest path calculation is only used for pairs of nodes not connected by an edge. Thus, by supplying a complete graph, the input can specify all of the relevant distances.
If newrank=true, the ranking algorithm does a single global ranking, ignoring clusters. This allows nodes to be subject to multiple constraints. Rank constraints will usually take precedence over edge constraints.
For other layouts, this affects the spacing between loops on a single node, or multiedges between a pair of nodes.
If Prism is not available, or the version of Graphviz is earlier than 2.28, "overlap=false" uses a Voronoi-based technique. This can always be invoked explicitly with "overlap=voronoi".
If the value is "scalexy", x and y are separately scaled to remove overlaps.
If the value is "compress", the layout will be scaled down as much as possible without introducing any overlaps, obviously assuming there are none to begin with.
N.B.The remaining allowed values of overlap correspond to algorithms which, at present, can produce bad aspect ratios. In addition, we deprecate the use of the "ortho*" and "portho*".
If the value is "vpsc", overlap removal is done as a quadratic optimization to minimize node displacement while removing node overlaps.
If the value is "orthoxy" or "orthoyx", overlaps are moved by optimizing two constraint problems, one for the x axis and one for the y. The suffix indicates which axis is processed first. If the value is "ortho", the technique is similar to "orthoxy" except a heuristic is used to reduce the bias between the two passes. If the value is "ortho_yx", the technique is the same as "ortho", except the roles of x and y are reversed. The values "portho", "porthoxy", "porthoxy", and "portho_yx" are similar to the previous four, except only pseudo-orthogonal ordering is enforced.
If the layout is done by neato with mode="ipsep", then one can use overlap=ipsep. In this case, the overlap removal constraints are incorporated into the layout algorithm itself. N.B. At present, this only supports one level of clustering.
Except for fdp and sfdp, the layouts assume overlap="true" as the default. Fdp first uses a number of passes using a built-in, force-directed technique to try to remove overlaps. Thus, fdp accepts overlap with an integer prefix followed by a colon, specifying the number of tries. If there is no prefix, no initial tries will be performed. If there is nothing following a colon, none of the above methods will be attempted. By default, fdp uses overlap="9:prism". Note that overlap="true", overlap="0:true" and overlap="0:" all turn off all overlap removal.
By default, sfdp uses overlap="prism0".
Except for the Voronoi and prism methods, all of these transforms preserve the orthogonal ordering of the original layout. That is, if the x coordinates of two nodes are originally the same, they will remain the same, and if the x coordinate of one node is originally less than the x coordinate of another, this relation will still hold in the transformed layout. The similar properties hold for the y coordinates. This is not quite true for the "porth*" cases. For these, orthogonal ordering is only preserved among nodes related by an edge.
If overlap_scaling is negative, the layout is scaled by -1*overlap_scaling times the average label size. If overlap_scaling is positive, the layout is scaled by overlap_scaling. If overlap_scaling is zero, no scaling is done.
For layouts which always do packing, such a twopi, the pack attribute is just used to set the margin.
Normally, a small pad is used for aesthetic reasons, especially when a background color is used, to avoid having nodes and edges abutting the boundary of the drawn region.
If this is set and is smaller than the size of the layout, a rectangular array of pages of the specified page size is overlaid on the layout, with origins aligned in the lower-left corner, thereby partitioning the layout into pages. The pages are then produced one at a time, in pagedir order.
At present, this only works for PostScript output. For other types of output, one should use another tool to split the output into multiple output files. Or use the viewport to generate multiple files.
Note that a cluster inherits the root graph's attributes if defined. Thus, if the root graph has defined a pencolor, this will override a color or bgcolor attribute set for the cluster.
Previous to 31 January 2008, the effect of penwidth=W was achieved by including setlinewidth(W) as part of a style specification. If both are used, penwidth will be used.
Note: Due to an artifact of the implementation, previous to 27 Feb 2014, final coordinates are translated to the origin. Thus, if you look at the output coordinates given in the (x)dot or plain format, pinned nodes will not have the same output coordinates as were given on input. If this is important, a simple workaround is to maintain the coordinates of a pinned node. The vector difference between the old and new coordinates will give the translation, which can then be subtracted from all of the appropriate coordinates.
After 27 Feb 2014, this translation can be avoided in neato by setting the notranslate to TRUE. However, if the graph specifies node overlap removal or a change in aspect ratio, node coordinates may still change.
In neato and fdp, pos can be used to set the initial position of a node. By default, the coordinates are assumed to be in inches. However, the -s command line flag can be used to specify different units. As the output coordinates are in points, feeding the output of a graph laid out by a Graphviz program into neato or fdp will almost always require the -s flag.
When the -n command line flag is used with neato, it is assumed the positions have been set by one of the layout programs, and are therefore in points. Thus, neato -n can accept input correctly without requiring a -s flag and, in fact, ignores any such flag.
A TRUE bool value corresponds to "normal"; a FALSE bool value corresponds to "none". As a slight exception to the normal interpretation of bool, a value of "2" corresponds to "fast".
T -> H;
will go
from left to right. By default, graphs are laid out from top to bottom.
This attribute also has a side-effect in determining how record nodes are interpreted. See record shapes.
In twopi, this attribute specifies the radial separation of concentric circles. For twopi, ranksep can also be a list of doubles. The first double specifies the radius of the inner circle; the second double specifies the increase in radius from the first circle to the second; etc. If there are more circles than numbers, the last number is used as the increment for the remainder.
If ratio is numeric, it is taken as the desired aspect ratio. Then, if the actual aspect ratio is less than the desired ratio, the drawing height is scaled up to achieve the desired ratio; if the actual ratio is greater than that desired ratio, the drawing width is scaled up.
If ratio = "fill" and the size attribute is set, node positions are scaled, separately in both x and y, so that the final drawing exactly fills the specified size. If both size values exceed the width and height of the drawing, then both coordinate values of each node are scaled up accordingly. However, if either size dimension is smaller than the corresponding dimension in the drawing, one dimension is scaled up so that the final drawing has the same aspect ratio as specified by size. Then, when rendered, the layout will be scaled down uniformly in both dimensions to fit the given size, which may cause nodes and text to shrink as well. This may not be what the user wants, but it avoids the hard problem of how to reposition the nodes in an acceptable fashion to reduce the drawing size.
If ratio = "compress" and the size attribute is set, dot attempts to compress the initial layout to fit in the given size. This achieves a tighter packing of nodes but reduces the balance and symmetry. This feature only works in dot.
If ratio = "expand", the size attribute is set, and both the width and the height of the graph are less than the value in size, node positions are scaled uniformly until at least one dimension fits size exactly. Note that this is distinct from using size as the desired size, as here the drawing is expanded before edges are generated and all node and text sizes remain unchanged.
If ratio = "auto", the page attribute is set and the graph cannot be drawn on a single page, then size is set to an ``ideal'' value. In particular, the size in a given dimension will be the smallest integral multiple of the page size in that dimension which is at least half the current size. The two dimensions are then scaled independently to the new size. This feature only works in dot.
If the root attribute is defined as the empty string, twopi will reset it to name of the node picked as the root node.
For twopi, it is possible to have multiple roots, presumably one for each component. If more than one node in a component is marked as the root, twopi will pick one.
If the attribute begins with a plus sign '+', an additive margin is specified. That is, "+w,h" causes the node's bounding box to be increased by w points on the left and right sides, and by h points on the top and bottom. Without a plus sign, the node is scaled by 1 + w in the x coordinate and 1 + h in the y coordinate.
If only a single number is given, this is used for both dimensions.
If unset but esep is defined, the sep values will be set to the esep values divided by 0.8. If esep is unset, the default value is used.
There is one exception to this usage. If shape is set to "epsf", shapefile gives a filename containing a definition of the node in PostScript. The graphics defined must be contain all of the node content, including any desired boundaries. For further details, see External PostScript files.
If defined and the drawing is larger than the given size, the drawing is uniformly scaled down so that it fits within the given size.
If size ends in an exclamation point (!), then it is taken to be the desired size. In this case, if both dimensions of the drawing are less than size, the drawing is scaled up uniformly until at least one dimension equals its dimension in size.
Note that there is some interaction between the size and ratio attributes.
(1 March 2007) The values line and spline can be used as synonyms for false and true, respectively. In addition, the value polyline specifies that edges should be drawn as polylines.
(28 Sep 2010) The value ortho specifies edges should be routed as polylines of axis-aligned segments. Currently, the routing does not handle ports or, in dot, edge labels.
(25 Sep 2012) The value curved specifies edges should be drawn as curved arcs.
splines=none splines="" | splines=line splines=false |
splines=polyline | splines=curved |
splines=ortho | splines=spline splines=true |
By default, the attribute is unset. How this is interpreted depends on the layout. For dot, the default is to draw edges as splines. For all other layouts, the default is to draw edges as line segments. Note that for these latter layouts, if splines="true", this requires non-overlapping nodes (cf. overlap). If fdp is used for layout and splines="compound", then the edges are drawn to avoid clusters as well as nodes.
If the default style attribute has been set for a component, an individual component can use style="" to revert to the normal default. For example, if the graph has
edge [style="invis"]
making all edges invisible, a specific edge can overrride this via:
a -> b [style=""]
Of course, the component can also explicitly set its style attribute to the desired value.
Use of color palettes results in less memory usage during creation of the bitmaps and smaller output files.
Usually, the only time it is necessary to specify the truecolor model is if the graph uses more than 256 colors. However, if one uses bgcolor=transparent with a color palette, font antialiasing can show up as a fuzzy white area around characters. Using truecolor=true avoids this problem.
If the node shape is regular, the width and height are made identical. In this case, if either the width or the height is set explicitly, that value is used. In this case, if both the width or the height are set explicitly, the maximum of the two values is used. If neither is set explicitly, the minimum of the two default values is used.
These labels are added after all nodes and edges have been placed. The labels will be placed so that they do not overlap any node or label. This means it may not be possible to place all of them. To force placing all of them, use the forcelabels attribute.
Provides z coordinate value for 3D layouts and displays. If the graph has dim set to 3 (or more), neato will use a node's z value for the z coordinate of its initial position if its pos attribute is also defined.
Even if no z values are specified in the input, it is necessary to declare a z attribute for nodes, e.g, using node[z=""] in order to get z values on output. Thus, setting dim=3 but not declaring z will cause neato -Tvrml to layout the graph in 3D but project the layout onto the xy-plane for the rendering. If the z attribute is declared, the final rendering will be in 3D.
A double with an optional prefix '+'.
A point with an optional prefix '+'.
"normal" | "inv" | ||
"dot" | "invdot" | ||
"odot" | "invodot" | ||
"none" | "tee" | ||
"empty" | "invempty" | ||
"diamond" | "odiamond" | ||
"ediamond" | "crow" | ||
"box" | "obox" | ||
"open" | "halfopen" | ||
"vee" |
The examples above show a set of commonly used arrow shapes. There is a grammar of arrow shapes which can be used to describe a collection of 3,111,696 arrow combinations of the 42 variations of the primitive set of 11 arrows. The basic arrows shown above contain most of the primitive shapes (box, crow, diamond, dot, inv, none, normal, tee, vee) plus ones that can be derived from the grammar (odot, invdot, invodot, obox, odiamond) plus some supported as special cases for backward-compatibility (ediamond, open, halfopen, empty, invempty).
"#%2x%2x%2x" | Red-Green-Blue (RGB) |
"#%2x%2x%2x%2x" | Red-Green-Blue-Alpha (RGBA) |
"H[, ]+S[, ]+V" | Hue-Saturation-Value (HSV) 0.0 <= H,S,V <= 1.0 |
string | color name |
String-valued color specifications are case-insensitive and interpreted in the context of the current color scheme, as specified by the colorscheme attribute. If this is undefined, the X11 naming scheme will be used. An initial "/" character can be used to override the use of the colorscheme attribute. In particular, a single initial "/" will cause the string to be evaluated using the default X11 naming. If the color value has the form "/ssss/yyyy", the name yyyy is interpreted using the schema ssss. If the color scheme name is empty, i.e., the color has the form "//yyyy", the colorscheme attribute is used. Thus, the forms "yyyy" and "//yyyy" are equivalent.
At present, Graphviz recognizes the default color scheme X11, and the Brewer color schemes (cf. ColorBrewer). Please note that Brewer color schemes are covered by this license.
Examples:
Color | RGB | HSV | String |
---|---|---|---|
White | "#ffffff" | "0.000 0.000 1.000" | "white" |
Black | "#000000" | "0.000 0.000 0.000" | "black" |
Red | "#ff0000" | "0.000 1.000 1.000" | "red" |
Turquoise | "#40e0d0" | "0.482 0.714 0.878" | "turquoise" |
Sienna | "#a0522d" | "0.051 0.718 0.627" | "sienna" |
The string value transparent can be used to indicate no color. This is only available in the output formats ps, svg, fig, vmrl, and the bitmap formats. It can be used whenever a color is needed but is most useful with the bgcolor attribute. Usually, the same effect can be achieved by setting style to invis.
NOTE: Gradient fills, described below, are currently only available via CAIRO or SVG rendering.
If the colorList value specifies multiple colors, with no weights, and a filled style is specified, a linear gradient fill is done using the first two colors. If weights are present, a degenerate linear gradient fill is done. This essentially does a fill using two colors, with the weights specifying how much of region is filled with each color. If the style attribute contains the value radial, then a radial gradient fill is done. These fills work with any shape.
For certain shapes, the style attribute can be set to do fills using more than 2 colors. See the style type for more information.
The following table shows some variations of the yellow:blue color list depending on the style and gradientangle attributes.
Gradient angle | style=filled | style=filled fillcolor=yellow;0.3:blue | style=radial |
---|---|---|---|
0 | |||
45 | |||
90 | |||
180 | |||
270 | |||
360 |
T -> H;
"forward" | "back" | ||
"both" | "none" |
For undirected edges T -- H;
, one of the nodes, usually
the righthand one, is treated as the head for the purpose of
interpreting "forward" and "back".
In addition, if the associated attribute is label, headlabel or taillabel, the escape sequences "\n", "\l" and "\r" divide the label into lines, centered, left-justified, and right-justified, respectively.
Obviously, one can use "\\" to get a single backslash. A backslash appearing before any character not listed above is ignored.
Thus, assuming the default values for layersep and layerlistsep, if layers="a:b:c:d:e:f:g:h", the layerRange string layers="a:b,d,f:all" would denote the layers a b d f g h".
The modes "node", "clust" or "graph" specify that the components should be packed together tightly, using the specified granularity. A value of "node" causes packing at the node and edge level, with no overlapping of these objects. This produces a layout with the least area, but it also allows interleaving, where a node of one component may lie between two nodes in another component. A value of "graph" does a packing using the bounding box of the component. Thus, there will be a rectangular region around a component free of elements of any other component. A value of "clust" guarantees that top-level clusters are kept intact. What effect a value has also depends on the layout algorithm. For example, neato does not support clusters, so a value of "clust" will have the same effect as the default "node" value.
The mode "array(_flag)?(%d)?" indicates that the components should be packed at the graph level into an array of graphs. By default, the components are in row-major order, with the number of columns roughly the square root of the number of components. If the optional flags contains 'c', then column-major order is used. Finally, if the optional integer suffix is used, this specifies the number of columns for row-major or the number of rows for column-major. Thus, the mode "array_c4" indicates array packing, with 4 rows, starting in the upper left and going down the first column, then down the second column, etc., until all components are used.
If a graph is smaller than the array cell it occupies, it is centered by default. The optional flags may contain 't', 'b', 'l', or 'r', indicating that the graphs should be aligned along the top, bottom, left or right, respectively.
If the optional flags contains 'u', this causes the insertion order of elements in the array to be determined by user-supplied values. Each component can specify its sort value by a non-negative integer using the sortv attribute. Components are inserted in order, starting with the one with the smallest sort value. If no sort value is specified, zero is used.
If dim is 3, point may also have the format "%f,%f,%f('!')?" to represent the point (x,y,z).
If a compass point is used, it must have the form "n","ne","e","se","s","sw","w","nw","c","_". This modifies the edge placement to aim for the corresponding compass point on the port or, in the second form where no portname is supplied, on the node itself. The compass point "c" specifies the center of the node or port. The compass point "_" specifies that an appropriate side of the port adjacent to the exterior of the node should be used, if such exists. Otherwise, the center is used. If no compass point is used with a portname, the default value is "_".
This attribute can be attached to an edge using the headport and tailport attributes, or as part of the edge description as in
Note that it is legal to have a portname the same as one of the compass points. In this case, this reference will be resolved to the port. Thus, if node A has a port w, then headport=w will refer to the port and not the compass point. At present, in this case, there is no way to specify that the compass point should be used.
Using "fast" gives about a 2-4 times overall speedup compared with "normal", though layout quality can suffer a little.
where spline | = | (endp)? (startp)? point (triple)+ |
and triple | = | point point point |
and endp | = | "e,%f,%f" |
and startp | = | "s,%f,%f" |
If style is present, it must be one of the strings "regular", "self", or "random". In the first case, the nodes are placed regularly about a circle. In the second case, an abbreviated version of neato is run to obtain the initial layout. In the last case, the nodes are placed randomly in a unit square.
If seed is present, it specifies a seed for the random number generator. If seed is a positive number, this is used as the seed. If it is anything else, the current time, and possibly the process id, is used to pick a seed, thereby making the choice more random. In this case, the seed value is stored in the graph.
If the value is just "random", a time-based seed is chosen.
Note that input positions, specified by a node's pos attribute, are only used when the style is "random".
where styleItem | = | name or name'('args')' |
and args | = | name ( ',' name )* |
NOTE:The styles tapered, striped and wedged are only available in release 2.30 and later.
At present, the recognized style names are "dashed", "dotted", "solid", "invis" and "bold" for nodes and edges, "tapered" for edges only, and "filled", "striped", "wedged", "diagonals" and "rounded" for nodes only. The styles "filled", "striped" and "rounded" are recognized for clusters. The style "radial" is recognized for nodes, clusters and graphs, and indicates a radial-style gradient fill if applicable.
The style "striped" causes the fill to be done as a set of vertical stripes. The colors are specified via a colorList, the colors drawn from left to right in list order. Optional color weights can be specified to indicate the proportional widths of the bars. If the sum of the weights is less than 1, the remainder is divided evenly among the colors with no weight. Note: The style "striped" is only supported with clusters and rectangularly-shaped nodes.
The style "wedged" causes the fill to be done as a set of wedges. The colors are specified via a colorList, with the colors drawn counter-clockwise starting at angle 0. Optional color weights are interpreted analogously to the striped case described above. Note: The style "wedged" is allowed only for elliptically-shaped nodes.
The following tables illustrate some of the effects of the style settings. Examples of tapered line styles are given below. Examples of linear and radial gradient fill can be seen under colorList.
solid | dashed | dotted | |||
bold | rounded | diagonals | |||
filled | striped | wedged |
solid | dashed | ||
dotted | bold | ||
solid | dashed | dotted | bold | ||||
rounded | filled | striped |
The effect of style=tapered depends on the penwidth, dir, arrowhead and arrowtail attributes. The edge starts with width penwidth and tapers to width 1, in points. The dir attribute determines whether the tapering goes from tail to head (dir=forward), from head to tail (dir=forward), from the middle to both the head and tail (dir=both), or no tapering at all (dir=none). If the dir is not explicitly set, the default for the graph type is used (see dir). Arrowheads and arrowtails are also drawn, based on the value of dir; to avoid this, set arrowhead and/or arrowtail to "none".
Note: At present, the tapered style only allows a simple filled polygon. Additional styles such as dotted or dashed, or multiple colors supplied via a colorList are ignored.
The following table illustrates the style=tapered with penwidth=7 and arrowtail=none.
dir \ arrowhead | normal | none |
forward | ||
back | ||
both | ||
none |
Additional styles are available in device-dependent form. Style lists are passed to device drivers, which can use this to generate appropriate output.
The style attribute affects the basic appearance of nodes, edges and graphs, but has no effect on any text used in labels. For this, use the fontname, fontsize and fontcolor attributes, or the <FONT>, <B>, <I>, etc. elements in HTML-like labels.
The setlinewidth style value can be used for more control over the width of node borders and edges than is allowed by bold. This style value takes an argument, specifying the width of the line in points. For example, style="bold" is equivalent to style="setlinewidth(2)". The use of setlinewidth is deprecated; one should use the penwidth attribute instead.
The viewPort W,H,Z,x,y or W,H,Z,N specifies a viewport for the final image. The pair (W,H) gives the dimensions (width and height) of the final image, in points. The optional Z is the zoom factor, i.e., the image in the original layout will be W/Z by H/Z points in size. By default, Z is 1. The optional last part is either a pair (x,y) giving a position in the original layout of the graph, in points, of the center of the viewport, or the name N of a node whose center should used as the focus. By default, the focus is the center of the graph bounding box, i.e., (bbx/2,bby/2), where "bbx,bby" is the value of the bounding box attribute bb.
Sample values: 50,50,.5,'2.8 BSD' or 100,100,2,450,300. The first will take the 100x100 point square centered on the node 2.8 BSD and scale it down by 0.5, yielding a 50x50 point final image.