10.1 Adding other vector graphics objects
In addition to graphs, a range of other objects can be placed on graphics canvas:
Rectangular boxes (the box command). Circles and arcs (the arc and circle commands). Ellipses and elliptical arcs (the ellipse command). Graphical images in bmp, eps, gif, jpeg or png formats (the eps and image commands). Lines and arrows (the arrow and line commands). Piecharts (the piechart command). Points labelled by crosses and other symbols (the point command). Polygons (the polygon command). Text labels (the text command).
Put together, these commands can be used to produce a wide range of vector graphics. The remainder of this chapter describes each of these commands in turn, providing a variety of examples of their use. These commands all interface with Pyxplot’s maths environment in common ways. For example, vector positions on the graphics canvas may be specified in three ways:
Two comma-separated dimensionless numbers, taken to be in centimetres, e.g. 4,5. Two comma-separated numbers with dimensions of length, e.g. 45*unit(mm), 13*unit(cm). As a vector, either dimensionless, or with units of length, e.g. vector(4,5) or vector(13,25)*unit(mm).
Many of these commands take rotation angles as inputs: these may be specified either as dimensionless numbers, taken to be in degrees, or as values with physical units of angle, e.g. 0.25*unit(rev). Where these commands take colors as inputs, as elsewhere in Pyxplot, the color may be specified in one of three ways:
As a number, referred to a color from a present palette; see Section 8.1.1. As a recognised named color, e.g. red; see Section 19.4 for a list of these. As an object of type color, for example, rgb(0,1,0), hsb(0.5,0.5,0.5), gray(0.2), colors.green + colors.red, colors.yellow - colors.green.
|
|