You can add labels and markers to arrows/lines. Markers are dots, tick marks, etc. along the line.
To add a single label, simply add a label to the arrow using the label
attribute
or the colon-label syntax as for blocks: a->b: This is the label.;
The position of the label can be set using the label.align
attribute, with
the values of 0 and 100 representing the start and end of the arrow (with values
proportionally in between, but you can also have negative values or above 100%).
With label.pos
you can set how the label is placed
in relation to the arrow line. It can take one of left
, right
, above
,
below
or center
, the latter meaning onto the line. The label orientation
can be influenced with label.orient
the same way as for blocks.
To add a single marker, use the label.align
to set its position and
optionally the marker.type
attribute to set its shape, using any of the arrowhead types
listed in Arrow and Line Attributes. You can apply to any of the arrowhead attributes
to marker.*
, specifically marker.type
, marker.gvtype
(to set the
arrowhead type in graphviz style), marker.size
and marker.color
.
You can add more labels by specifying them in curly braces after the arrow. Their syntax is as follows.
[mark] [extend] <position> [<attributes>];
<position>
is specified as a) a percentage number (followed by a percentage sign);
b) a percentage number (followed by a percentage sign) followed by an optional sign and an offset
number in pixels; or c) an offset number in pixels (no percentage sign). The percentage number is
interpreted so that 0% means the start of the arrow, 100% means its entire length. A positive
percentage number is measured from the start of the arrow forward, while a negative value means
measuring it from the end of the arrow backwards. Thus, 99% is the same as -1%. The offset value
is then added/substracted from this position (interpreted in pixels). If only a pixel value is
specified, a positive value is measured from the start of the arrow forward, a negative value backward.
If you specify extend
, the start of the measurement changes: for positive values we start
to measure from the end of the arrow forward (beyond the end of the arrow), for negative values we
start measuring from the start of the arrows (before the start).
It is actually simpler than it sounds, here are a few examples.
![]() | ![]() |
Adding the mark
keyword before the position will add a marker at the
designated position. In this case there is no need to specity a label, if
you just want the marker. The default type for markers is marker.gvstyle=tick
,
which is a thin line perpendicular to the arrow line.
Among attributes you can use marker.*
to set the marker style;
label
, text.*
, label.pos
and label.orient
to specify
the label and its details; and line.*
, fill.*
and shadow.*
to specify a box around the label.
As a shorthand, you can omit the curly braces and simply specify the labels after the arrow specification.