Skip to content Accesskey=4Skip to sub-navigation Accesskey=3View our Accessibility Options MIT Information Systems Home About IS&T Contact IS&T Site Map Search Advanced Search
Getting StartedGetting Services by Topic or Alphabetically Getting Help

On This Page

[Help]

  

Quick Links

Top Level

Related Links

Ask OLC a question

Athena Consulting Homepage

Helpdesk Stock Answers (for Mac/PC questions)


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

MIT Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility
Ask a technology question or send a comment about this web page.