10.4 The arrow and line commands

Arrows may also be added to multiplot canvases using the arrow command, which has syntax:

arrow from x,y to x,y

The arrow command may be followed by the with keyword to specify to style of the arrow. The line type, line width and color of the arrow, may be specified using the same syntax as used in the plot command, using the linetype, linewidth and color modifiers after the word with, as in the example:

arrow from 0,0 to 10,10 \
with linetype 2 linewidth 5 color red

The style of the arrow may also be specified after the word with, and three options are available: head (the default), nohead, which produces line segments with no arrowheads on them, and twoway, which produces bidirectional arrows with heads on both ends.

The arrow command has a twin, the line command, which has the same syntax but with a different style setting of nohead.

Example: A simple notice generated with the text and arrow commands

In this example script, we use Pyxplot’s arrow and text commands to produce a simple notice advertising that a lecture has moved to a different seminar room:
set multiplot ; set nodisplay

w = unit(20*cm) # Width of notice
h = w/sqrt(2) # Height of notice

# Put a rectangular box around notice
line from 0,0 to w,0 with linewidth 5
line from w,0 to w,h with linewidth 5
line from w,h to 0,h with linewidth 5
line from 0,h to 0,0 with linewidth 5

# Write text of notice
set texthalign center ; set fontsize 3
text r"$\backslash $bf Astrophysical Fluids Lecture" at w/2,3/4*h
text r"$\backslash $bf MOVED to Seminar Room 3" at w/2, h/2
arrow from w/4, h/4 to 3/4*w, h/4 with linewidth 8

# Display notice
set display ; refresh
\includegraphics[width=\textwidth ]{examples/eps/ex_notice}