Daniel@0: Daniel@0: Daniel@0: Daniel@0:
Daniel@0:![]() | ![]() | ![]() | ![]() |
box Daniel@0: | polygon Daniel@0: | ellipse Daniel@0: | circle Daniel@0: |
![]() | ![]() | ![]() | ![]() |
point Daniel@0: | egg Daniel@0: | triangle Daniel@0: | plaintext Daniel@0: |
![]() | ![]() | ![]() | ![]() |
diamond Daniel@0: | trapezium Daniel@0: | parallelogram Daniel@0: | house Daniel@0: |
![]() | ![]() | ![]() | ![]() |
pentagon Daniel@0: | hexagon Daniel@0: | septagon Daniel@0: | octagon Daniel@0: |
![]() | ![]() | ![]() | ![]() |
doublecircle Daniel@0: | doubleoctagon Daniel@0: | tripleoctagon Daniel@0: | invtriangle Daniel@0: |
![]() | ![]() | ![]() | ![]() |
invtrapezium Daniel@0: | invhouse Daniel@0: | Mdiamond Daniel@0: | Msquare Daniel@0: |
![]() | ![]() | ![]() | ![]() |
Mcircle Daniel@0: | rect Daniel@0: | rectangle Daniel@0: | none Daniel@0: |
![]() | ![]() | ![]() | ![]() |
note Daniel@0: | tab Daniel@0: | folder Daniel@0: | box3d Daniel@0: |
![]() | |||
component Daniel@0: |
Daniel@0: The geometries of polygon-based shapes are also affected Daniel@0: by the node attributes Daniel@0: regular, Daniel@0: peripheries and Daniel@0: orientation. Daniel@0: If shape="polygon", the attributes Daniel@0: sides, Daniel@0: skew and Daniel@0: distortion are also used. Daniel@0: If unset, they default to 4, 0.0 and 0.0, respectively. Daniel@0: In addition, the 3 M* shapes support auxiliary labels using Daniel@0: the toplabel and Daniel@0: bottomlabel attributes. Daniel@0: On the other hand, the point shape is special in that it is Daniel@0: only affected by the peripheries, Daniel@0: width and Daniel@0: height attributes. Daniel@0: Daniel@0:
rlabel | = | field ( '|' field )* |
where field | = | fieldId or '{' rlabel '}' |
and fieldId | = | [ '<' string '>'] [ string ] |
Daniel@0: The first string in fieldId assigns a portname to the field and can Daniel@0: be combined with the node name to indicate where to attach an edge Daniel@0: to the node. (See portPos.) Daniel@0: The second string is used as the text for the field; it supports the usual Daniel@0: escape sequences \n, \l and \r. Daniel@0:
Daniel@0: Visually, a record is a box, with fields represented by alternating Daniel@0: rows of horizontal or vertical subboxes. The Mrecord shape is identical Daniel@0: to a record shape, except that the outermost box has rounded corners. Daniel@0: Flipping between horizontal and vertical layouts is done by nesting Daniel@0: fields in braces "{...}". The top-level orientation in a record is Daniel@0: horizontal. Thus, a record with label "A | B | C | D" will have 4 fields Daniel@0: oriented left to right, while "{A | B | C | D}" will have them Daniel@0: from top to bottom and "A | { B | C } | D" will have "B" over "C", with Daniel@0: "A" to the left and "D" to the right of "B" and "C". Daniel@0:
Daniel@0: The initial orientation of a record node depends on the Daniel@0: rankdir attribute. If this attribute Daniel@0: is TB (the default) or TB, corresponding to vertical Daniel@0: layouts, the top-level fields in a record are displayed horizontally. Daniel@0: If, however, this attribute is LR or RL, Daniel@0: corresponding to horizontal layouts, the top-level fields are Daniel@0: displayed vertically. Daniel@0:
Daniel@0: As an example of a record node, the dot input Daniel@0:
Daniel@0: If we add the line Daniel@0:
Daniel@0: If we change node struct1 to have shape Mrecord,
Daniel@0: it then looks like:
Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0: Thus, the code Daniel@0:
Daniel@0: As an example of rounding, dot uses the graph Daniel@0:
Daniel@0: Additional styles may be available with a specific code generator. Daniel@0:
Daniel@0: If the value of a label attribute Daniel@0: (label for nodes, edges, clusters, and Daniel@0: graphs, and the Daniel@0: headlabel and Daniel@0: taillabel Daniel@0: attributes of an edge) is given as an Daniel@0: HTML string, Daniel@0: that is, delimited by <...> Daniel@0: rather than "...", Daniel@0: the label is interpreted as Daniel@0: an HTML description. At their simplest, such labels Daniel@0: can describe multiple lines of variously aligned text as provided by ordinary Daniel@0: string labels. More generally, the Daniel@0: label can specify a table similar to those provided by HTML, Daniel@0: with different graphical attributes at each level. Daniel@0:
Daniel@0: NOTE: The features and syntax supported by these labels are Daniel@0: modeled on HTML. However, there are many aspects that are relevant Daniel@0: to Graphviz labels that are not in HTML and, conversely, HTML allows Daniel@0: various constructs which are meaningless in Graphviz. We will generally Daniel@0: refer to these labels as "HTML labels" rather than the cumbersome Daniel@0: "HTML-like labels" but the reader is warned that these are not really Daniel@0: HTML. The grammar below describes precisely what Graphviz will accept. Daniel@0:
Daniel@0: Although HTML labels are not, strictly speaking, a shape, they can be Daniel@0: viewed as a generalization of the record shapes described above. Daniel@0: In particular, if a node has set its Daniel@0: shape Daniel@0: attribute to plaintext, the HTML label will be the node's Daniel@0: shape. On the other hand, if the node has any other shape (except Daniel@0: point), the HTML label will be embedded within the node the Daniel@0: same way an ordinary label would be. Daniel@0:
Daniel@0: The following is an abstract grammar for HTML labels. Daniel@0: Terminals, corresponding to elements, are shown in bold font, Daniel@0: and nonterminals in italics. Daniel@0: Square brackets [ and ] enclose optional items. Daniel@0: Vertical bars | separate alternatives. Daniel@0: Note that, as in HTML, element and attribute names are case-insensitive. Daniel@0: (cf. sections 3.2.1 and 3.2.2 of the Daniel@0: HTML 4.01 specification). Daniel@0:
label | Daniel@0:: | Daniel@0:text | Daniel@0:
Daniel@0: | | | Daniel@0:table | Daniel@0:
text | Daniel@0:: | Daniel@0:textitem | Daniel@0:
Daniel@0: | | | Daniel@0:text textitem | Daniel@0:
textitem | Daniel@0:: | Daniel@0:string | Daniel@0:
Daniel@0: | | | Daniel@0:<BR/> | Daniel@0:
Daniel@0: | | | Daniel@0:<FONT> text </FONT> | Daniel@0:
table | Daniel@0:: | Daniel@0:[ <FONT> ] <TABLE> rows </TABLE> [ </FONT> ] | Daniel@0:
rows | Daniel@0:: | Daniel@0:row | Daniel@0:
Daniel@0: | | | Daniel@0:rows row | Daniel@0:
row | Daniel@0:: | Daniel@0:<TR> cells </TR> | Daniel@0:
cells | Daniel@0:: | Daniel@0:cell | Daniel@0:
Daniel@0: | | | Daniel@0:cells cell | Daniel@0:
cell | Daniel@0:: | Daniel@0:<TD> label </TD> | Daniel@0:
Daniel@0: | | | Daniel@0:<TD> <IMG/> </TD> | Daniel@0:
Daniel@0: Above, a string is any collection of printable characters, including Daniel@0: all spaces. Note that outside of the body of a <TD> element, Daniel@0: whitespace characters are ignored; within a <TD> element, spaces Daniel@0: are preserved but all other white space characters are discarded. Daniel@0: HTML comments are allowed within an HTML string. They can occur anywhere Daniel@0: provided that, if they contain part of an HTML element, they must contain Daniel@0: the entire element. Daniel@0:
Daniel@0: As is obvious from the above description, the interpretation of white space Daniel@0: characters is one place where HTML-like labels is very different from Daniel@0: standard HTML. In HTML, any sequence of white space characters is Daniel@0: collapsed to a single space, If the user does not want this to happen, the Daniel@0: input must use non-breaking spaces " ". This makes sense in Daniel@0: HTML, where text layout depends dynamically on the space available. In Daniel@0: Graphviz, the layout is statically determined by the input, so it is Daniel@0: reasonable to treat ordinary space characters as non-breaking. In addition, Daniel@0: ignoring tabs and newlines allows the input text to be formatted for Daniel@0: easier reading. Daniel@0:
Daniel@0: Each of the HTML elements has a set of optional attributes. Daniel@0: Attribute values must appear in double quotes. Daniel@0:
<TABLE Daniel@0: ALIGN="CENTER|LEFT|RIGHT" Daniel@0: BGCOLOR="color" Daniel@0: BORDER="value" Daniel@0: CELLBORDER="value" Daniel@0: CELLPADDING="value" Daniel@0: CELLSPACING="value" Daniel@0: COLOR="color" Daniel@0: FIXEDSIZE="FALSE|TRUE" Daniel@0: HEIGHT="value" Daniel@0: HREF="value" Daniel@0: PORT="portName" Daniel@0: TARGET="value" Daniel@0: TITLE="value" Daniel@0: TOOLTIP="value" Daniel@0: VALIGN="MIDDLE|BOTTOM|TOP" Daniel@0: WIDTH="value" Daniel@0: > Daniel@0:Daniel@0:
Daniel@0:
<TR Daniel@0: <!-- No attributes --> Daniel@0: > Daniel@0:Daniel@0:
Daniel@0:
<TD Daniel@0: ALIGN="CENTER|LEFT|RIGHT|TEXT" Daniel@0: BALIGN="CENTER|LEFT|RIGHT" Daniel@0: BGCOLOR="color" Daniel@0: BORDER="value" Daniel@0: CELLPADDING="value" Daniel@0: CELLSPACING="value" Daniel@0: COLOR="color" Daniel@0: COLSPAN="value" Daniel@0: FIXEDSIZE="FALSE|TRUE" Daniel@0: HEIGHT="value" Daniel@0: HREF="value" Daniel@0: PORT="portName" Daniel@0: ROWSPAN="value" Daniel@0: TARGET="value" Daniel@0: TITLE="value" Daniel@0: TOOLTIP="value" Daniel@0: VALIGN="MIDDLE|BOTTOM|TOP" Daniel@0: WIDTH="value" Daniel@0: > Daniel@0:Daniel@0: Daniel@0:
Daniel@0:
<FONT Daniel@0: COLOR="color" Daniel@0: FACE="fontname" Daniel@0: POINT-SIZE="value" Daniel@0: > Daniel@0:Daniel@0: Daniel@0:
Daniel@0:
<BR Daniel@0: ALIGN="CENTER|LEFT|RIGHT" Daniel@0: > Daniel@0:Daniel@0: Daniel@0:
Daniel@0:
<IMG Daniel@0: SCALE="FALSE|TRUE|WIDTH|HEIGHT|BOTH" Daniel@0: SRC="value" Daniel@0: > Daniel@0:Daniel@0: Daniel@0:
Daniel@0: ALIGN Daniel@0:
Daniel@0: specifies horizontal placement. When an object is allocated Daniel@0: more space than required, this value determines where the extra space Daniel@0: is placed left and right of the object. Daniel@0:Daniel@0: Daniel@0: BALIGN Daniel@0:Daniel@0:
Daniel@0:
Daniel@0:- CENTER aligns the object in the center. (Default)
Daniel@0:- LEFT aligns the object on the left.
Daniel@0:- RIGHT aligns the object on the right.
Daniel@0:- (
Daniel@0:<TD> only) TEXT aligns lines of text using the full Daniel@0: cell width. The alignment of a line is determined by its (possibly Daniel@0: implicit) associated<BR> element.Daniel@0: The contents of a cell are normally aligned as a block. In particular, Daniel@0: lines of text are first aligned as a text block based on the width of Daniel@0: the widest line and the corresponding
<BR> elements. Then, Daniel@0: the entire text block is aligned within a cell. If, however, the Daniel@0: cell's ALIGN value is"TEXT" , and the cell contains Daniel@0: lines of text, then the lines are justified using the entire available Daniel@0: width of the cell. If the cell does not contain text, then the contained Daniel@0: image or table is centered. Daniel@0:
Daniel@0: specifies the default alignment ofDaniel@0: Daniel@0: BGCOLOR="color" Daniel@0:<BR> elements contained Daniel@0: in the cell. That is, if a<BR> element has no Daniel@0: explicit ALIGN attribute, the attribute value is specified Daniel@0: by the value of BALIGN. Daniel@0:
Daniel@0: sets the color of the background. This color can be Daniel@0: overridden by a BGCOLOR attribute in descendents. Daniel@0:Daniel@0: Daniel@0: BORDER="value" Daniel@0:
Daniel@0: specifies the width of the border around the object in points. Daniel@0: A value of zero indicates no border. The default is 1. Daniel@0: The maximum value is 255. Daniel@0: If set in a table, and CELLBORDER is not set, Daniel@0: this value is also used for all cells in the table. Daniel@0: It can be overridden by a BORDER tag in a cell. Daniel@0:Daniel@0: Daniel@0: CELLBORDER="value" Daniel@0:
Daniel@0: specifies the width of the border for all cells in a table. Daniel@0: It can be overridden by a BORDER tag in a cell. Daniel@0: The maximum value is 255. Daniel@0:Daniel@0: Daniel@0: CELLPADDING="value" Daniel@0:
Daniel@0: specifies the space, in points, between a cell's border and its content. Daniel@0: The default is 2. Daniel@0: The maximum value is 255. Daniel@0:Daniel@0: Daniel@0: CELLSPACING="value" Daniel@0:
Daniel@0: specifies the space, in points, between cells in a table and between Daniel@0: a cell and the table's border. The default is 2. Daniel@0: The maximum value is 127. Daniel@0:Daniel@0: Daniel@0: COLOR="color" Daniel@0:
Daniel@0: sets the color of the font within the scope of Daniel@0: <FONT>...</FONT>, or the border color Daniel@0: of the table or cell within the scope of Daniel@0: <TABLE>...</TABLE>, Daniel@0: or <TD>...</TD>. Daniel@0: This color can be Daniel@0: overridden by a COLOR attribute in descendents. Daniel@0: By default, the font color is determined by the Daniel@0: fontcolor attribute of Daniel@0: the corresponding node, edge or graph, and the border color Daniel@0: is determined by the Daniel@0: color attribute of Daniel@0: the corresponding node, edge or graph. Daniel@0:Daniel@0: Daniel@0: COLSPAN="value" Daniel@0:
Daniel@0: specifies the number of columns spanned by the cell. The default is 1. Daniel@0: The maximum value is 65535. Daniel@0:Daniel@0: Daniel@0: FACE="fontname" Daniel@0:
Daniel@0: specifies the font to use within the scope of Daniel@0: <FONT>...</FONT>. Daniel@0: This can be Daniel@0: overridden by a FACE attribute in descendents. Daniel@0: By default, the font name is determined by the Daniel@0: fontname attribute of the corresponding Daniel@0: node, edge or graph. Daniel@0:Daniel@0: Daniel@0: FIXEDSIZE Daniel@0:
Daniel@0: specifies whether the values given by the WIDTH Daniel@0: and HEIGHT attributes are enforced. Daniel@0:Daniel@0: Daniel@0: HEIGHT="value" Daniel@0:Daniel@0:
Daniel@0:
Daniel@0:- FALSE allows the object to grow so that all its contents will fit. (Default)
Daniel@0:- TRUE fixes the object size to its given WIDTH Daniel@0: and HEIGHT. Daniel@0: Both of these attributes must be supplied.
Daniel@0:
Daniel@0: specifies the mininum height, in points, of the object. The height Daniel@0: includes the contents, any spacing and the border. Unless Daniel@0: FIXEDSIZE is true, the height will be expanded to allow Daniel@0: the contents to fit. Daniel@0: The maximum value is 65535. Daniel@0:Daniel@0: Daniel@0: HREF="value" Daniel@0:
Daniel@0: attaches a URL to the object. Daniel@0:Daniel@0: Daniel@0: POINT-SIZE="value" Daniel@0:
Daniel@0: sets the size of the font, in points, used within the scope of Daniel@0: <FONT>...</FONT>. Daniel@0: This can be Daniel@0: overridden by a POINT-SIZE attribute in descendents. Daniel@0: By default, the font size is determined by the Daniel@0: fontsize attribute of the corresponding Daniel@0: node, edge or graph. Daniel@0:Daniel@0: Daniel@0: PORT="value" Daniel@0:
Daniel@0: attaches a portname to the object. Daniel@0: (See portPos.) Daniel@0: This can be used to modify the head Daniel@0: or tail of an edge, so that the end attaches directly to the object. Daniel@0:Daniel@0: Daniel@0: ROWSPAN="value" Daniel@0:
Daniel@0: specifies the number of rows spanned by the cell. The default is 1. Daniel@0: The maximum value is 65535. Daniel@0:Daniel@0: Daniel@0: SCALE Daniel@0:
Daniel@0: specifies how an image will use any extra space available in its cell. Daniel@0: Allowed values are Daniel@0:Daniel@0: Daniel@0: SRC="value" Daniel@0:Daniel@0:
Daniel@0: If this attribute is undefined, Daniel@0: the image inherits the imagescale Daniel@0: attribute of the graph object being drawn. Daniel@0: As with the imagescale Daniel@0: attribute, if the cell has a fixed size and the image is too large, Daniel@0: any offending dimension will be shrunk to fit the space, the Daniel@0: scaling being uniform in width and height if SCALE="true". Daniel@0:- FALSE : keep image its natural size. (Default)
Daniel@0:- TRUE : scale image uniformly to fit.
Daniel@0:- WIDTH : expand image width to fill
Daniel@0:- HEIGHT : expand image height to fill
Daniel@0:- BOTH : expand both image width height to fill
Daniel@0:
Daniel@0: specifies the image file to be displayed in the cell. Daniel@0: Note that if the software is used as a web server, file system access Daniel@0: to images is more restricted. See GV_FILE_PATH Daniel@0: and SERVER_NAME. Daniel@0:Daniel@0: Daniel@0: TARGET="value" Daniel@0:
Daniel@0: determines which window of the browser is used for the URL if the object Daniel@0: has one. Daniel@0: See W3C documentation. Daniel@0:Daniel@0: Daniel@0: TITLE="value" Daniel@0:
Daniel@0: sets the tooltip annotation attached to the element. Daniel@0: This is used only if the element has a HREF attribute. Daniel@0:Daniel@0: Daniel@0: TOOLTIP="value" Daniel@0:
Daniel@0: is an alias for TITLE. Daniel@0:Daniel@0: Daniel@0:
Daniel@0: VALIGN Daniel@0:
Daniel@0: specifies vertical placement. When an object is allocated Daniel@0: more space than required, this value determines where the extra space Daniel@0: is placed above and below the object. Daniel@0:Daniel@0: Daniel@0: WIDTH="value" Daniel@0:Daniel@0:
Daniel@0:
Daniel@0:- MIDDLE aligns the object in the center. (Default)
Daniel@0:- LEFT aligns the object on the left.
Daniel@0:- RIGHT aligns the object on the right.
Daniel@0:
Daniel@0: specifies the mininum width, in points, of the object. The width Daniel@0: includes the contents, any spacing and the border. Unless Daniel@0: FIXEDSIZE is true, the width will be expanded to allow Daniel@0: the contents to fit. Daniel@0: The maximum value is 65535. Daniel@0:Daniel@0: Daniel@0:
Daniel@0: There is some inheritance among the attributes. If a table specifies Daniel@0: a CELLPADDING, CELLBORDER or BORDER Daniel@0: value, this value is used by the table's Daniel@0: cells unless overridden. If a cell or table specifies a BGCOLOR, Daniel@0: this will be the background color for all of its descendents. Daniel@0: Of course, if a background or fill color is specified for the Daniel@0: graph object owning the label, this will be the original Daniel@0: background for the label. Daniel@0: The object's fontname, fontcolor and fontsize attributes Daniel@0: are the default for drawing text. These can be overridden by using Daniel@0: FONT to set new values. The new font values will hold Daniel@0: until overridden by an enclosed FONT element. Daniel@0: Finally, the pencolor or color of the graph object will be used as Daniel@0: the border color. Daniel@0:
Daniel@0: Because of certain limitations in handling tables in a device-independent Daniel@0: manner, when BORDER is 1 and both table and cell borders Daniel@0: are on and CELLSPACING is less than 2, anomalies can arise Daniel@0: in the output, such as gaps between sides of borders which should be Daniel@0: abutting or even collinear. The user can usual get around this by increasing Daniel@0: the border size or the spacing, or turning off the table border. Daniel@0:
Daniel@0: As an example of HTML labels, the dot input Daniel@0:
left | mid dle | right |
one | two |
hello world |
Daniel@0: b | Daniel@0:g | Daniel@0:h | Daniel@0:||
c | d | e | Daniel@0:|||
f | Daniel@0:
Daniel@0: As usual, an HTML specification is more verbose. On the other hand, Daniel@0: HTML labels are much more general, as the following example shows: Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0: The source for this graph can be found here. Daniel@0:
Daniel@0: Here is an example using <FONT> elements Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0: with the input graph. Daniel@0:
Daniel@0: Here is an example using an <IMG> element Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0: with the input graph. Daniel@0: Daniel@0:
Daniel@0: The table below
Daniel@0: gives the shape names and the corresponding node shapes.
Daniel@0:
Daniel@0:
Daniel@0: