10.10 The box and circle commands

Rectangular boxes and circles may be placed on multiplot canvases using the box and circle commands, as in:

box from 0*unit(mm),0*unit(mm) to 25*unit(mm),70*unit(mm)
circle at 0*unit(mm),0*unit(mm) radius 70*unit(mm)

In the former case, two corners of the rectangle are specified, meanwhile in the latter case the centre of the circle and its radius are specified. The box command may also be invoked by the synonym rectangle. Boxes may be rotated using an optional rotate modifier, which may be followed by a counter-clockwise rotational angle which may either have dimensions of angle, or is assumed to be in degrees if dimensionless. The rotation is performed about the centre of the rectangle:

box from 0,0 to 10,3 rotate 45

The positions and dimensions of boxes may also be specified by giving the position of one of the corners of the box, together with its width and height. The specified corner is assumed to be the bottom-left corner if both the specified width and height are positive; other corners may be specified if the supplied width and/or height are negative. If such boxes are rotated, the rotation is about the specified corner:

box at 0,0 width 10 height 3 rotate 45

The line type, line width, and color of line with which the outlines of boxes and circles are drawn may be specified as in the arrow command, for example:

circle at 0,0 radius 5 with linetype 1 linewidth 2 color red

The shapes may be filled by specifying a fillcolor:

circle at 0,0 radius 5 with lw 10 color red fillcolor yellow

Example: A simple no-entry sign

In this example script, we use Pyxplot’s box and circle commands to produce a no-entry sign warning passers by that code monkeys can turn nasty when interrupted from their work.
set multiplot ; set nodisplay

w = 10 # Width of sign / cm

# Make no-entry sign
circle at 0,0 radius w with col null fillcol red 
box from -(0.8*w),-(0.2*w) to (0.8*w),(0.2*w) $\backslash $
    with col null fillcol white

# Put a warning beneath the sign
set fontsize 3
set texthalign center ; set textvalign center
text r"$\backslash $bf Keep Out! Code Monkey at work!" at 0,-1.2*w

# Display sign
set display ; refresh