next up previous contents
Next: Plotting points Up: Plotting in Maple Previous: The basic plotting command

Multiple plots

It is very easy to plot multiple curves or objects in the same picture. For a collection of functions, simply give the functions as a list or a set, all using the same independent variable.

> plot( { cos(x),-cos(x),0.5*(sin(19*x)+sin(21*x)) }, 
> x=0..2*Pi,numpoints=1000,scaling=CONSTRAINED);
[画像:\epsfig{width=]
Notice that Maple automatically colors the three curves differently. This can be changed by the color option. The numpoints option specifies that a much larger number of points should be plotted, in order to achieve a smoother looking curve.

The plots package, which is loaded by the command:

> with(plots);

[画像:\begin{maplelatex} \begin{eqnarray*} \lefteqn{[\mathit{animate}, \mathit{anima... ...\mathit{textplot3d}, \\ & & \mathit{tubeplot}] \end{eqnarray*}\end{maplelatex}]
contains many commands which allow much finer control over how to put together a picture.

The most important of these is the display command. We can define various plot commands and assign them to variable names.

> p1:=plot( {cos(x),-cos(x)}, x=0..2*Pi,color=blue,linestyle=3):
> p2:=plot( .5*(sin(19*x)+sin(21*x)),
> x=0..2*Pi,color=red,numpoints=1000 ):
The outer cosine curves are dashed (linestyle option), colored blue, and stored in p1. Note that this line ends with a colon : . That prevents the output of the actual commands that constitute the plot, which are quite voluminous. The superposition of the high frequency sine curves is colored red. The plot is actually made by the following command.
> display({p1,p2}, axes=boxed,view=[0..2*Pi,-2..2],scaling=CONSTRAINED);
[画像:\epsfig{width=]
The display command puts together any list or set of plots with prescribed options.


next up previous contents
Next: Plotting points Up: Plotting in Maple Previous: The basic plotting command
David J. Wright
2003年03月12日

AltStyle によって変換されたページ (->オリジナル) /