Credits | Overview | Plotting Styles | Commands | Terminals |
---|
Arbitrary arrows can be placed on a plot using the set arrow command.
Syntax:
set arrow {<tag>} from <position> to <position> set arrow {<tag>} from <position> rto <position> set arrow {<tag>} from <position> length <coord> angle <ang> set arrow <tag> arrowstyle | as <arrow_style> set arrow <tag> {nohead | head | backhead | heads} {size <headlength>,<headangle>{,<backangle>}} {fixed} {filled | empty | nofilled | noborder} {front | back} {linestyle | ls <line_style>} {linetype | lt <line_type>} {linewidth | lw <line_width>} {linecolor | lc <colorspec>} {dashtype | dt <dashtype>}
unset arrow {<tag>} show arrow {<tag>}
<tag> 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 set arrow with the appropriate tag and specify the attributes to be changed.
The position of the first end point of the arrow is always specified by "from". The other end point can be specified using any of three different mechanisms. The <position>s 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. See coordinates for details. A coordinate system specifier does not carry over from the first endpoint description the second.
1) "to <position>" specifies the absolute coordinates of the other end.
2) "rto <position>" specifies an offset to the "from" position. 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.
3) "length <coordinate> angle <angle>" specifies the orientation of the arrow in the plane of the graph. Again any of the coordinate systems can be used to specify the length. The angle is always in degrees.
Other characteristics of the arrow can either be specified as a pre-defined arrow style or by providing them in set arrow command. For a detailed explanation of arrow characteristics, see arrowstyle.
Examples:
To set an arrow pointing from the origin to (1,2) with user-defined linestyle 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 arrowarrows demos.