Stat/Math
Software Support
Software Consulting
Software Availability
Software Price
Contact

User Support
Documentation
Knowledge Base
Education
Consulting
Podcasts

Systems & Services
Cyberinfrastructure
Supercomputers
Grid Computing
Storage
Visualization
Digital Libraries & Data

Results & Impact
Publications
Grants & Grant Info
Events & Outreach
Economic Impact
Survey Results

Vision & Planning
News & Features

# Plotting with Maple

## The plot Command

The basic plot command:

> plot( 3*x^2 - x^4, x = -2 .. 2 );

Add a restriction on the range:

> plot( exp(x), x=-10..10, y=-10..10);

Plot several curves simultaneously:

> plot( {cos(x), 1 - x^2/2, 1 - x^2/2 + x^4/24}, x=-6..6, y=-2..2);

Fill areas in various colors (one custom, one standard):

> plot([cos(x),4-x^2], x=-2..2, filled=true, color=[COLOR(RGB,.9,.9,.99), blue],scaling=constrained);

Fill a more complicated area:

> plot([min(max(sin(x),cos(x)),0), max(min(sin(x),cos(x)),0), sin(x), cos(x)],
x=-8.75*Pi..11.25*Pi, filled=true, color=[white,white,red,red],
xtickmarks=[], scaling=constrained );

## The plot3d Command

A basic 3D plot:

> plot3d( cos(x) + y^2/2, x=-10..10, y=-2..2);

Add some options [most options can also be selected interactively, from menus]:

> plot3d( cos(x) + y^2/2, x=-10..10, y=-5..5,
scaling=constrained, style=patchcontour, axes=boxed,

Plot a parametric curve in R2:

> plot( [ t*cos(t), t*sin(t), t = 0 .. 2*Pi ] );

and a parametric surface in R3:

> plot3d( [ r*cos(th), r*sin(th), cos(th)*sin(th) ],
r = 0 .. 1, th = 0 .. 2*Pi, grid = [10,60],
z = x*y/(x^2 + y^2);

For more information on plot, plot3d, and their options, from the Maple Help menu do a Topic Search on plot. Select from any of approximately 100 related topics.

## The plots Package

The "plots" package contains additional, more specialized plotting functions.

> with(plots):

Plot parametric curves in 3D:

> plotopts:= t=0..20*Pi, orientation=[0,60], numpoints=1000, scaling=constrained:
> p1:=spacecurve([cos(1.1*t)*(5+sin(t)),sin(1.1*t)*(5+sin(t)),cos(t)],
> p2:=spacecurve([cos(2*t)*(5+sin(9*t)),sin(2*t)*(5+sin(9*t)),cos(9*t)],
> display({p1,p2});

Display different types of plots, together:

> p2 := implicitplot( {x*y=.1, x*y=.2, x*y=.3, x*y=-.1, x*y=-.2, x*y=-.3},
x=-1..1, y=-1..1, color=red, thickness=2):
> p3 := textplot( [0, .75, `Gradients are normal to level curves!`],
font=[HELVETICA,BOLDOBLIQUE,14] );
> display({p1,p2,p3});

Some elliptic curves, plotted together:

> plotopts := x=-5..5, y=-5..5, numpoints=2500, color=blue, thickness=2,
axes=boxed, xtickmarks=[-2,0,2,4], ytickmarks=[-2,0,2]:
> for i to 7 do
q.i := implicitplot(y^2 = x^3 + (4-i)*x^2,plotopts):
od:
> B := array(1..2,1..3,[[q1,q2,q3],[q4,q6,q7]]): display(B);

A fancy 3D plot, using the tubeplot command:

> f:= [(t-5*Pi)*sin(t)/3, (t-5*Pi)*cos(t)/3, (t-5*Pi)*.9, t=0 .. 5*Pi]:
tubepoints = 25, style=PATCH

This is one of many examples distributed with Maple.

Often there is more than one way to approach a problem.

> with(student); > showtangent(x^2, x=1);
> with(plots): with(plottools):
> p1:=plot(x^2, x = -1..2, thickness=2, color=green):
p2:=plot(2*x-1, x = .25 .. 1.75, thickness=3, color=blue):
p3:=circle([1, 1], .05, color=red, thickness=3):
p4:=textplot( [2, .25, `Slope = 2`], font=[HELVETICA,BOLDOBLIQUE,14] ):
p5:=arrow([1.65,.5],[-.5,.4],.05,.2,.2, color=red):
# On PCs, go to ^^^^^^ [1.05,.9] #
p6:=textplot( [2.5, 2, `y = 2 x - 1`], view=[-1..3, -1..4], font=[TIMES,ITALIC,10]):
> display({p1,p2,p3,p4,p5},scaling=constrained);