How to PLOT in Maple
The basic plot syntax is:
> plot(f(x), x=a..b)
e.g. > plot(sin(x), x=-Pi..Pi);
for a parametric plot:
> plot([fx(t),fy(t), t=a..b])
e.g. > plot([sin(t),cos(t), t=0..2*Pi]);
for a 3D plot:
> plot3d(f(x,y), x=a..b, y=c..d)
e.g. > plot3d(sin(x*y), x = -Pi..Pi, y = -Pi..Pi);
For information on changing the appearance of a plot, adding a title,
etc., type:
> ?plot[options]
The "plots" package contains functions for many other types of plots
(type ?plots for a complete list).
To plot of a set of 2D points, you can give the points as a bracketed
list and use the "style=point" option. For example:
> plot([[1,2], [-1,2], [1,3]], style=point);
Another way to do this is to use "pointplot" from the "plots" package;
"plots" also includes an analagous "pointplot3d" function for plotting
sets of 3D points. For example:
> with(plots);
> pointplot([[1,2], [-1,2], [1,3]]);
> pointplot3d([[0,1,1], [1,2,2], [1,3,5]]);
> pointplot3d([[0,1,1], [1,2,2], [1,3,5]],axes=boxed,color=red);
Here is an example of how to take two lists of data (containing, for
example "x" values and "y" values), combine them with the 'zip' routine,
and plot them with "x" values on the horizontal axis, "y" on the vertical:
> xlist := [0,1,2,3]:
> ylist := [-1,1,-2,2]:
> xylist := zip( (x,y) -> [x,y], xlist, ylist );
xylist := [[0,-1],[1,1],[2,-2],[3,2]]
> plot(xylist, style=point);
To reverse things so that the "x" values are displayed vertically:
> xylist := zip( (x,y) -> [y,x], xlist, ylist );
xylist := [[-1,0],[1,1],[-2,2],[2,3]]
> plot(xylist, style=point);
For more information, see online help on the topics:
plot, plot3d,pointplot, pointplot3d, plots
|