Node Shapes


The geometries of all node shapes are affected by the node attributes fixedsize, fontname, fontsize, height, label, style and width.

Polygon-based Nodes

The possible polygon-based shapes are displayed below.
box polygon ellipse circle
point egg triangle plaintext
diamond trapezium parallelogram house
hexagon octagon doublecircle doubleoctagon
tripleoctagon invtriangle invtrapezium invhouse
Mdiamond Msquare Mcircle
The geometries of polygon-based shapes are also affected by the node attributes regular, peripheries and orientation. If shape="polygon", the attributes sides, skew and distortion are also used. If unset, they default to 4, 0.0 and 0.0, respectively. In addition, the 3 M* shapes support auxiliary labels using the toplabel and bottomlabel attributes. On the other hand, the point shape is special in that it is only affected by the peripheries, width and height attributes.

Record-based Nodes

These are specified by shape values of "record" and "Mrecord". The structure of a record-based node is determined by its label, which has the following schema:
rlabel=field ( '|' field )*
where field=fieldId or '{' rlabel '}'
and fieldId= ( '<' string '>') ( string }
Literal braces, vertical bars and angle brackets must be escaped. Spaces are interpreted as separators between tokens, so they must be escaped if you want spaces in the text.

The first string in fieldId gives a name to the field and can be combined with the node name to denote the end of an edge. The second string is used as the text for the field; it supports the usual escape sequences \n, \l and \r.

Visually, a record is a box, with fields represented by alternating rows of horizontal or vertical subboxes. The Mrecord shape is identical to a record shape, except that the outermost box has rounded corners.

As an example of a record node, the dot input

digraph structs { node [shape=record]; struct1 [shape=record,label="<f0> left|<f1> mid\ dle|<f2> right"]; struct2 [shape=record,label="<f0> one|<f1> two"]; struct3 [shape=record,label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"]; struct1:f1 -> struct2:f0; struct1:f2 -> struct3:here; } yields the figure

PostScript-based Nodes

There is a third type of node shape which is dependent on using PostScript output. If a node has shape="espf", it should also have its shapefile attribute set. This should be the name of the file providing a definition of the node shape in PostScript. The file must contain an epsf-compliant "BoundingBox" comment, which defines a fixed size for the node. The rest of the file, except for additional comments, should be PostScript commands for drawing the node at the origin, starting after a "newpath" command and within its own graphics context.

More information can be found on the page How to create custom shapes.