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.
\begin{table}
\begin{minipage}[t]{5.5in}
\begin{center}
\bgroup
\linespread{1.1...
... radius {\tt r}. \\
\end{tabbing}\egroup
\end{center}\end{minipage}\end{table}

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.
\begin{figure}\centerline{\psfig{file=Diagrams/circlesine.ps,width=5in,height=3in}}
\end{figure}



Gaston Gonnet
1998-09-15