plots - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Graphics : Packages : plots : plots/shadebetween

plots

  

shadebetween

  

shade the area or volume between two functions

 

Calling Sequence

Parameters

Options

Summary

Description

Using Plotting Options

Examples

Compatibility

Calling Sequence

shadebetween(f, g, x=a..b)

shadebetween(f1, g1, x=a..b, y=c..d)

shadebetween(p, q, a..b)

shadebetween(p1, q1, a..b, c..d)

Parameters

f, g

-

expressions in the variable x

f1, g1

-

expressions in the variables x and y

x, y

-

names

a, b, c, d

-

real constants

p, q

-

procedures or operators taking one argument

p1,q1

-

procedures or operators taking two arguments

Options

• 

changefill : a list of plotting options to be applied to the filled region

• 

negativeonly : show only regions where the difference of the first two arguments is negative; default is false

• 

positiveonly : show only regions where the difference of the first two arguments is positive; default is false

• 

showboundary : boolean indicating if the boundaries should be shown; default is true

Summary

• 

The shadebetween command colors the area between two curves or two surfaces. The calling sequences are very similar to those of the plot and plot3d commands, except that you are providing two curves or surfaces instead of one. These can be given as expressions or procedures. Plotting options can be provided, including ones specifically for the filled region. The following example colors the area between x and x2 in blue.

with(plots):

shadebetween(x, x^2, x=0..2, color="Blue");

Description

• 

The shadebetween command colors the area between two curves in a 2-D plot or the volume between two surfaces in a 3-D plot. Specifically, given functions fx and gx, it colors the area where a point u,v has a value v between fu and gu. In the 3-D case, given functions fx,y and gx,y, it colors the area where a point u,v,w has a value w between fu,v and gu,v.

• 

In the first calling sequence, f and g are two expressions in the variable x, and the third argument has the type name=range. This calling sequence is similar to the one required for the plot command and produces a 2-D plot. The second calling sequence requires two expressions in variables x and y, along with two additional arguments of type name=range, and is similar to that for the plot3d command.

• 

The third and fourth calling sequences are similar to the operator-form calling sequences for the plot and plot3d commands and produce 2-D and 3-D plots respectively. The parameters p and q must take one argument and return a numeric value, while the parameters p1 and q1 take two arguments and return a numeric value.

• 

The positiveonly and negativeonly options allow you to plot only those regions where the difference of the first two arguments is either positive or negative respectively. These are set to false by default.

• 

The showboundary option is set to true by default and causes the curves or surfaces as specified in the first two arguments to shadebetween to be displayed. If this option is set to false, then only the filled region is displayed.

Using Plotting Options

• 

Additional plotting options, if applicable, may be given with any of the calling sequences. These are described in the plot/option and plot3d/option help pages. The coords option does not work with this command.

• 

Options that you wish to have applied to the filled region only may be given in a list using the changefill option. For example, the following command displays the curves in blue but the filled region in orange.

shadebetween(x, x^2, x=0..2, color="Blue", thickness=3, changefill=[color="Orange"]);

• 

The filled areas corresponding to the positive or negative parts can have different characteristics. This is done by  providing a suboption of the form optname=[value1, value2] within the changefill option.  For example, the following command colors the positive part orange and the negative part yellow.

shadebetween(x, x^2, x=0..2, color="Blue", thickness=3, changefill=[color=["Orange", "Yellow"]]);

Examples

withplots:

The region between sinx and cosx is filled.

shadebetweensinx,cosx,x=0..2Pi,size=500,300

The region between sinx and cosx where cosx<sinx is filled.

shadebetweensinx&comma;cosx&comma;x&equals;0..2Pi&comma;positiveonly&comma;size&equals;500&comma;300

Options can be provided to customize the look of the plot.

shadebetweenx2&comma;x35x&comma;x&equals;0..4&comma;axes&equals;boxed&comma;color&equals;Niagara Azure&comma;thickness&equals;2&comma;gridlines

The calling sequence below uses the operator form. Also, the changefill option affects the look of the filled region.

shadebetweensin&comma;cos&comma;0..Pi&comma;color&equals;Niagara Blue&comma;thickness&equals;3&comma;changefill&equals;color&equals;Niagara LeafGreen&comma;transparency&equals;0.8

The fill for the positive and negative parts can have different properties.

shadebetweensin&comma;cos&comma;0..Pi&comma;color&equals;Niagara Blue&comma;thickness&equals;3&comma;changefill&equals;color&equals;Niagara LeafGreen&comma;Niagara DarkOrchid&comma;transparency&equals;0.4&comma;0.8

The region between two surfaces in 3-D is shown below.

shadebetweensinxcosy&comma;sinxcosy2&comma;x&equals;0..Pi&comma;y&equals;0..Pi&comma;color&equals;Niagara Azure&comma;changefill&equals;color&equals;Niagara Violet

The operator form is used here to create the 3-D plot, and the surfaces are omitted with the showboundary option set to false.

shadebetweenu&comma;v&rarr;sinucosv&comma;u&comma;v&rarr;sinucosv2&comma;0..Pi&comma;0..Pi&comma;showboundary&equals;false&comma;changefill&equals;color&equals;Niagara Cinnamon&comma;transparency&equals;0.0

In the following example, there is no filled area in the first plot which uses the positiveonly option, since the first argument's values are always less than or equal to those of the second.

plots:-displayArrayshadebetweenx2&plus;y2&comma;x2&plus;y2&comma;x&equals;1..1&comma;y&equals;1..1&comma;grid&equals;20&comma;20&comma;positiveonly&comma;shadebetweenx2&plus;y2&comma;x2&plus;y2&comma;x&equals;1..1&comma;y&equals;1..1&comma;grid&equals;20&comma;20

Compatibility

• 

The plots:-shadebetween command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

See Also

plot

plot/option

plot3d

plot3d/option