next up previous contents
Next: Creating Dot Plots Up: Creating Plots Previous: Superimposing Plots

More Complicated Plots

The final version of the DrawPlot command allows for text, lines or circles to be drawn. The parameters passed to this form of the DrawPlot command are somewhat more complicated than the examples above.
DrawPlot(obj : set)
Each element of the set obj must consist of a LTEXT, CTEXT, RTEXT, LINE, or CIRCLE structue. Table [*] gives a description and argument list for each.

Table: The shape parameters for the DrawPlot function.
... radius {\tt r}. \\

Darwin can not produce tek code for these types of plots. Only POSTSCRIPT code can be generated. Therefore, the system variable plotdevice must be assigned either psportrait, pslandscape, or ps.

As an illustration, we draw a chain consisting of 801 overlapping circles placed at the points (x, sin(x)), for $-10 \leq x \leq 10$.

> pts := CreateArray(1..801):   # allocate an array to store the points
> for i from 0 to 800 do
>   # calculate next centroid.
>   scratch := -10 + i * 20 / 800:        
>   # create a circle of radius 10.
>   pts[i+1] := CIRCLE(scratch, sin(scratch), 10);  
> od:
> # add the label
> pts := [op(pts), CTEXT(-1.3, 1, 'Circles and Sine')];  
> DrawPlot(pts):
The results of this short program are shown in Figure [*].

Figure: A figure showing 801 overlapping circles drawn along the sine curve.

Gaston Gonnet