Plots with Units - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Graphics : plot/units

Plots with Units

 

Calling Sequence

Parameters

Options

Description

Notes

Examples

Calling Sequence

plot(f, r1, r2, opts)

plot3d(f, r1, r2, opts)

Parameters

f

-

expression or procedure to be plotted

r1

-

range of the form a..b or var=a..b

r2

-

range of the form a..b or var=a..b 

opts

-

plotting options

Options

• 

useunits (boolean or list): Indicates presence of units in input or specifies units to be used.

Description

• 

The plot and plot3d commands allow input arguments that involve units. Units may appear in the expression or procedure to be plotted or in one or more range arguments. These units are then included in the axis labels.

• 

This help page describes the use of units in the parameters of plot and plot3d. For general information about the calling sequences of these commands, see plot and plot3d.

• 

If f is an expression containing a unit, then the plot is computed using the quantity, without the unit, and the unit is included as part of the dependent axis label (that is, the y-axis label for 2-D plots and the z-axis label for 3-D plots).

• 

If f is a procedure that evaluates to a numeric value with a unit, then the unit is ignored during computation. (See the Notes section below for more information.)

• 

The range arguments r1 and r2 can be in the form of a simple range, a..b, or an equation with a variable name as the left-hand side, var=a..b. If the range a..b contains a unit, then that unit is included in the label for that axis. The unit can be part of a or b, or both. If a and b contain different units, then the plotting command attempts to convert them to a common unit and issues an error if this is not possible.

• 

The useunits option may be used for two purposes:

  

useunits=true (or simply useunits) tells the plotting command that the input procedure involves computation with units.  This is necessary if there is no other indication through the ranges of the presence of units.

  

useunits=[unit1, unit2] or [unit1, unit2, unit3] can be used to specify the units for each axis label. If the name default is given for any of these entries, then a default axis label is produced.

• 

If the labels option is provided, then that value is used for the axes labels, overriding any default labels computed from the function and range arguments or the useunits option.

• 

All other plot options normally available with the plot and plot3d commands can be provided, but units in these option values are not generally understood or processed.

Notes

• 

For the sake of efficient computation, if f is a procedure, values computed from f are assumed to be unit-free unless there is an indication that units are present.  For this reason, you must explicitly specify the  units desired, either through the ranges or through the useunits option. If the useunits=true option is not provided with a procedure that produces values containing units, an empty plot might result.

• 

Plotting commands generally try to use the faster evalhf mode of computation whenever possible. (For more information about the evalhf mode, see the plot/computation help page.) However, evalhf does not work with procedures that return values with units. If you wish to plot a procedure that involves extremely intensive computation, it is recommended you do not perform computations with units within the procedure.

• 

For axis labels, any unit information provided in the ranges overrides units provided in the plotting function. Additionally, the value of the useunits option, if given, overrides all other unit information given in the other arguments. However, if the labels option is provided, then that will be used by the plotting command to generate axis labels and units information will be ignored.

• 

Units cannot be used with plotting functions given in parametric form.

Examples

Create a simple 2-D plot. The unit appears on the y-axis.

plotx2m,x=5..5

Include units with the x-axis range.

plotsinx,x=2π..2πradians,axis1=tickmarks=spacingπ,color=Indigo

In the example below, centimeters are converted to meters.

plotx2,0.5x2,x=150cm..5m,axes=boxed

Use a procedure as input. The useunits option must be provided to indicate that the procedure involves computation with units.

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

Include a unit with the x-axis and y-axis ranges.

plotx→cosx,0..2πradians,2..2m,axis1=tickmarks=spacingπ2

Use the useunits option to specify which units should be displayed in the axis labels.

plotx→x2,5..5,useunits=s,m

See Also

plot

plot/computation

plot/options

plot3d

plot3d/options

units

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam