next up previous contents index
Next: Autoscale Up: Set-show Previous: Angles   Contents   Index


Arrow

Arbitrary arrows can be placed on a plot using the set arrow command.

Syntax:

     set arrow {<tag>} {from <position>} {to|rto <position>}
               { {arrowstyle | as <arrow_style>}
                 | { {nohead | head | backhead | heads}
                     {size <length>,<angle>{,<backangle>}}
                     {filled | empty | nofilled}
                     {front | back}
                     { {linestyle | ls <line_style>}
                       | {linetype | lt <line_type>}
                         {linewidth | lw <line_width} } } }


     unset arrow {<tag>}
     show arrow {<tag>}

5#5tag6#6 is an integer that identifies the arrow. If no tag is given, the lowest unused tag value is assigned automatically. The tag can be used to delete or change a specific arrow. To change any attribute of an existing arrow, use the set arrow command with the appropriate tag and specify the parts of the arrow to be changed.

The 5#5position6#6s are specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. Unspecified coordinates default to 0. The end points can be specified in one of five coordinate systems -- first or second axes, graph, screen, or character. See coordinates (p. [*]) for details. A coordinate system specifier does not carry over from the "from" position to the "to" position. Arrows outside the screen boundaries are permitted but may cause device errors. If the end point is specified by "rto" instead of "to" it is drawn relatively to the start point. For linear axes, graph and screen coordinates, the distance between the start and the end point corresponds to the given relative coordinate. For logarithmic axes, the relative given coordinate corresponds to the factor of the coordinate between start and end point. Thus, a negative relative value or zero are not allowed for logarithmic axes.

Specifying nohead produces an arrow drawn without a head -- a line segment. This gives you yet another way to draw a line segment on the plot. By default, an arrow has a head at its end. Specifying backhead draws an arrow head at the start point of the arrow while heads draws arrow heads on both ends of the line. Not all terminal types support double-ended arrows.

Head size can be controlled by size 5#5length6#6,5#5angle6#6 or size 5#5length6#6,5#5angle6#6,5#5backangle6#6, where 5#5length6#6 defines length of each branch of the arrow head and 5#5angle6#6 the angle (in degrees) they make with the arrow. 5#5Length6#6 is in x-axis units; this can be changed by first, second, graph, screen, or character before the 5#5length6#6; see coordinates (p. [*]) for details. 5#5Backangle6#6 only takes effect when filled or empty is also used. Then, 5#5backangle6#6 is the angle (in degrees) the back branches make with the arrow (in the same direction as 5#5angle6#6). The fig terminal has a restricted backangle function. It supports three different angles. There are two thresholds: Below 70 degrees, the arrow head gets an indented back angle. Above 110 degrees, the arrow head has an acute back angle. Between these thresholds, the back line is straight.

Specifying filled produces filled arrow heads (if heads are used). Filling is supported on filled-polygon capable terminals, see help of pm3d (p. [*]) for their list, otherwise the arrow heads are closed but not filled. The same result (closed but not filled arrow head) is reached by specifying empty. Further, filling and outline is obviously not supported on terminals drawing arrows by their own specific routines, like metafont, metapost, latex or tgif.

The line style may be selected from a user-defined list of line styles (see set style line (p. [*])) or may be defined here by providing values for 5#5line_type6#6 (an index from the default list of styles) and/or 5#5line_width6#6 (which is a multiplier for the default width).

Note, however, that if a user-defined line style has been selected, its properties (type and width) cannot be altered merely by issuing another set arrow command with the appropriate index and lt or lw.

If front is given, the arrow is written on top of the graphed data. If back is given (the default), the arrow is written underneath the graphed data. Using front will prevent an arrow from being obscured by dense data.

Examples:

To set an arrow pointing from the origin to (1,2) with user-defined style 5, use:

     set arrow to 1,2 ls 5

To set an arrow from bottom left of plotting area to (-5,5,3), and tag the arrow number 3, use:

     set arrow 3 from graph 0,0 to -5,5,3

To change the preceding arrow to end at 1,1,1, without an arrow head and double its width, use:

     set arrow 3 to 1,1,1 nohead lw 2

To draw a vertical line from the bottom to the top of the graph at x=3, use:

     set arrow from 3, graph 0 to 3, graph 1 nohead

To draw a vertical arrow with T-shape ends, use:

     set arrow 3 from 0,-5 to 0,5 heads size screen 0.1,90

To draw an arrow relatively to the start point, where the relative distances are given in graph coordinates, use:

     set arrow from 0,-5 rto graph 0.1,0.1

To draw an arrow with relative end point in logarithmic x axis, use:

     set logscale x
     set arrow from 100,-5 rto 10,10

This draws an arrow from 100,-5 to 1000,5. For the logarithmic x axis, the relative coordinate 10 means "factor 10" while for the linear y axis, the relative coordinate 10 means "difference 10".

To delete arrow number 2, use:

     unset arrow 2

To delete all arrows, use:

     unset arrow

To show all arrows (in tag order), use:

     show arrow

http://gnuplot.sourceforge.net/demo/arrowstyle.htmlarrows demos.


next up previous contents index
Next: Autoscale Up: Set-show Previous: Angles   Contents   Index
Ethan Merritt 2007-03-03