MaplePortal/UnitsInPlots - Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MaplePortal/UnitsInPlots

Using Units in Plots

 

Go to Maple Portal     Maple Portal for Engineers

 

Introduction

Units in 2-D Plots

Plotting Expressions versus Procedures with Units

Units in 3-D Plots

See Also

Introduction

Maple allows you to create both 2-D and 3-D plots with units. The units can be supplied in the function, ranges, or as an option. The axis labels will display the unit information deduced from the arguments.

Units in 2-D Plots

 

You can add units from the Units palette to an expression that is graphed with the plot command.

 

Example: In this example, units are added to the x-range and the expression.

plotsinxm,x=0..2πrad

You can create a plot with units interactively by using the Context Panel on an expression with units.

 

Example: From the Context Panel for the expression, select Plots>2-D Plot.

 

.3 x4+200m

 

You can also add units with the 'useunits' option. With this option, the units are given in a list useunits=[units for x, units for y].

 

Example:

plotsin2xx,x=0..2π,useunits=min,m,color=Blue

 

Instead of using the palette, you can add units with the Unit command.

Example:plotx3+5x2,x=0..5,useunits=Unitkg,Unitm,color=Chocolate

 

Plotting Expressions versus Procedures with Units

You can create a graph with units from an expression or a procedure. See the help page plot/details for more information.

 

When you plot an expression, the axes labeling shows the variable names and units. This is shown in the following example (as well as all the earlier examples).

 

Example:

a2.7 tcos28t:

trange0..4s:

yrange0..3ft:

plota,t=trange,y=yrange

When you plot a procedure, such as the function h defined here, no variable names are used.

 

Example:

ht2.7 tcos28t: 

ploth,trange,yrange

Note: To plot a procedure that contains units, you must tell the plotting command that units are involved so that the procedure is properly processed. For computational efficiency, when a procedure is plotted, the values returned from the procedure are assumed to be unit-free by default. Therefore, if your procedure returns a numeric value with units, you must specify to the plotting command that units are involved. You can specify this by including units in the ranges or by using setting the option useunits=true (or simply useunits).   See the help page Plots with Units for details.

 

Example: Specify that units are involved in the procedure by using units in the ranges.

plotxx2m,5..5s,0..25m,thickness=2,color=DarkGreen

Alternatively, indicate that the procedure returns units by using the useunits option. The first example simply indicates that the procedure involves units, while the second example specifies units to be displayed on the axes.

plotx→x2m,5..5,useunits,thickness=2,color=DarkGreen

plotx→x2m,5..5,useunits=s,m,thickness=2,color=DarkGreen

To make further modifications to any plot, you can use options to the plot command, or make modifications interactively by clicking on the plot and using the Edit > Plot menu options.

Units in 3-D Plots

 

The plot3d command recognizes units similarly to the plot command.

 

Example:

plot3dsinxy1,x=0..4π,y=0..2,useunits=s,kg,m2kg

See Also

plot, plot3d, Plots with Units, Unit, Units Tutorial

 

Go to Maple Portal     Maple Portal for Engineers