10.11 The arc command
Partial arcs of circles may be drawn using the arc command. This has similar syntax to the circle command, but takes two additional angles, measured clockwise from the upward vertical direction, which specify the extent of the arc to be drawn. The arc is drawn clockwise from start to end, and hence the following two instructions draw two complementary arcs which together form a complete circle:
arc at 0,0 radius 5 from -90 to 0 with lw 3 col red
arc at 0,0 radius 5 from 0 to -90 with lw 3 col green
If a fillcolor is specified, then a pie-wedge is drawn:
arc at 0,0 radius 5 from 0 to 30 with lw 3 fillcolor red
Example: Labelled diagrams of triangles
In this example, we make a subroutine to draw labelled diagrams of the interior angles of triangles, taking as its inputs the lengths of the three sides of the triangle to be drawn and the position of its lower-left corner. The subroutine calculates the positions of the three vertices of the triangle and then labels them. We use Pyxplot’s automatic handling of physical units to generate the latex strings required to label the side lengths in centimetres and the angles in degrees. We use Pyxplot’s arc
command to draw angle symbols in the three corners of a triangle.
Example: A labelled diagram of a converging lens forming a real image
In this example, we make a subroutine to draw labelled diagrams of converging lenses forming real images.