How Do I - Maple Programming Help

Home : Support : Online Help : Getting Started : How Do I... : HowDoI/PlotMultipleFunctions

How Do I

 Plot Multiple Functions?

Using Commands

Plotting Lists of Expressions

The following examples with the plot command provide a list of expressions to plot.

Note: In Maple, a list is denoted using [ ] square brackets.

Example: Plotting Sine and Cosine on Same Plot



 Step Description Illustration 1 Type the following:   plot([sin, cos]) $\mathrm{plot}\left(\left[\mathrm{sin},\mathrm{cos}\right]\right)$ 2 Press Enter to display the plot. 

Example: Plotting $x,{x}^{2}$ with Custom Color

 Step Description Illustration 1 Type the following:   plot([x,x^2,x=0..2,color=blue,red]) $\mathrm{plot}\left(\left[x,{x}^{2}\right],x=0..2,\mathrm{color}=\left[\mathrm{blue},\mathrm{red}\right]\right)$ 2 Press Enter. 

Example: Plotting a Sequence



Step

Description

Illustration

1

Type the following:

plot([seq(BesselJ(n,x),n=1..4,x=0..2*Pi,filled)

$\mathrm{plot}\left(\left[\mathrm{seq}\left(\mathrm{BesselJ}\left(n,x\right),n=1..4\right)\right],x=0..2\cdot \mathrm{Pi},\mathrm{filled}\right)$





2

Press Enter.



Example: Plotting Multiple 3-D Plots

This also works for 3-D plots:



Step

Description

Illustration

1

Type the following:

plot3d([x,sin(x)*y], x=-2*Pi..2*Pi, y=-5..5)





2

Press Enter.



Plotting Multiple Plot Structures

You can also combine multiple plot structures and display these together using the plots:-display command:

Example: Plotting Multiple Plot Structures Together

 Step Description Illustration 1 Type the following: plot1:= plot(sin):   Then, press Enter. $\mathrm{plot1}≔\mathrm{plot}\left(\mathrm{sin}\right):$   2 Type the following:     plot2 := plot(cos, color=blue):   Then, press Enter. $\mathrm{plot2}≔\mathrm{plot}\left(\mathrm{cos},\mathrm{color}=\mathrm{blue}\right):$   3 Type the following:   plots:-display([plot(sin), plot(cos, color=blue)])   Then, press Enter. $\mathrm{plots}:-\mathrm{display}\left(\left[\mathrm{plot}\left(\mathrm{sin}\right),\mathrm{plot}\left(\mathrm{cos},\mathrm{color}=\mathrm{blue}\right)\right]\right)$ 

Example: Plotting Multiple 3-D Plots

The plots:-display command also works on 3-D plots:

$\mathrm{plot3}≔\mathrm{plot3d}\left(\mathrm{sin}\left(x\right)\cdot y,x=-2\cdot \mathrm{Pi}..2\cdot \mathrm{Pi},y=-5..5\right):$

$\mathrm{plot4}≔\mathrm{plot3d}\left(\sqrt{y},x=-2\cdot \mathrm{Pi}..2\cdot \mathrm{Pi},y=-5..5\right):$

$\mathrm{plots}:-\mathrm{display}\left(\left[\mathrm{plot3},\mathrm{plot4}\right]\right)$

Drag and Drop

You can also combine multiple plots using drag and drop.

Example: Combining the Plots for $\mathrm{sin}\left(x\right)$ and $\mathrm{sin}\left(\frac{x}{2}\right)$

 Step Description Illustration 1 Type the following: sin(x)   Press Enter.   Right-click sin(x) and choose Plots > 2-D Plot. $\mathrm{sin}\left(x\right)$$\to$  2 Type the following:  sin(x/2)   3 Drag the expression $\mathrm{sin}\left(\frac{x}{2}\right)$ onto the existing plot of $\mathrm{sin}\left(x\right)$. 

 Related Topics The How Do I... topics cover the essentials for doing mathematics in Maple.  Learn more about available tools and features, such as palettes and context-sensitive menus. Refer to Help>Quick Reference for basic Getting Started tips.