 contourplot3d - Maple Help

Home : Support : Online Help : Graphics : 3-D : contourplot3d

plots

 contourplot
 2-D contour plotting
 contourplot3d
 3-D contour plotting Calling Sequence

 contourplot(expr1, opts) contourplot3d(expr1, opts) contourplot(expr1, x=a..b, y=c..d, opts) contourplot3d(expr1, x=a..b, y=c..d, opts) contourplot(f, a..b, c..d, opts) contourplot3d(f, a..b, c..d, opts) contourplot([exprf, exprg, exprh], s=a..b, t=c..d, opts) contourplot3d([exprf, exprg, exprh], s=a..b, t=c..d, opts) contourplot([f, g, h], a..b, c..d, opts) contourplot3d([f, g, h],a..b, c..d, opts) Parameters

 f, g, h - function(s) to be plotted expr1 - expression in x and y exprf, exprg, exprh - expressions in s and t a, b - real constants c, d - real constants, procedures or expressions in x x, y, s, t - names opts - (optional) plot options Description

 • Both contourplot and contourplot3d take the same arguments and generate a contour plot for a given expression or function. In other words, these commands both produce a set of level curves of the input function for a discrete set of values (i.e. levels) of the third coordinate. The differences are as follows: contourplot3d generates a 3-D view of the contours raised to their appropriate levels, whereas contourplot generates a flat 2-D contour. A 2-D contour can be displayed with a 3-D contour to create a drop-shadow view of the plot (see plottools[transform] for an example). Furthermore, contourplot3d is faster than contourplot. In the following sections and examples, all the features and functionalities apply to both contourplot and contourplot3d, with the exception of color bars, which apply only to 2-D contour plots.
 • The five different calling sequences to the contourplot function above all define a contour plot. The first three calling sequences describe contour plots in Cartesian coordinates while the last two describe contour parametric plots.
 • In the first two calling sequences, contourplot(expr1) and contourplot(expr1, x=a..b, y=c..d), the expression expr1 must be a Maple expression in the names x and y.  The range a..b must evaluate to real constants. The range c..d must either evaluate to real constants or be expressions in x. They specify the range over which expr1 is plotted.
 If the ranges in these calling sequences are omitted, Maple tries to determine a suitable range automatically. In this case, you can still include the variables x and y to specify the order for these variables: contourplot(expr1, x, y). You cannot supply only one range, or only one variable.
 • In the third calling sequence, contourplot(f, a..b, c..d), f must be a Maple procedure or operator which takes two arguments. Operator notation must be used, that is, the procedure name is given without parameters specified, and the ranges must be given simply in the form a..b, rather than as an equation. The second range c..d can have arguments evaluating to real constants or procedures of one variable.
 • A contour parametric plot can be defined by three expressions expr1, expr2, and expr3 in two variables.  In the fourth calling sequence, contourplot([expr1, expr2,expr3], s=a..b, t=c..d), expr1, expr2, and expr3 must be Maple expressions in the names s and t.
 • Finally, in the fifth calling sequence, contourplot([f, g, h], a..b, c..d), f, g, and h must be Maple procedures or operators taking two arguments.  Here again, operator notation must be used.
 • A contour plot can also be created from a list of data.  See plots[listcontplot] and plots[listcontplot3d] for details. Options

 • Options opts are specified as equations of the form option = value.  For example, the option grid = [m, n] where m and n are positive integers specifies that the contourplot is to be constructed on an m by n grid at equally spaced points in the ranges a..b and c..d respectively. By default a 25 by 25 grid is used, thus 625 points are generated.  See plot/options and plot3d/option for more information.  The gridstyle option is not available for contourplot3d.
 • There are eight contour levels by default. You can alter the number and the location of the contours used with the option contours = c where c is either an integer specifying the number of evenly spaced levels or a list of points representing the contour levels.
 • Contour labels showing the contour values associated with each curve can be controlled with the contourlabels = t option, where t is true, false or a list. When t is not false, a contour label appears when the pointer hovers over a curve. The option contourlabels on its own is equivalent to contourlabels = true. Contour labels are available for 2-D plots only and are displayed by default.
 • For 2-D contour plots a color bar is displayed by default, unless you specify a legend via the legend option below or a user specified list of contours is given with the option contours = [c1, c2, ... ] as above. To suppress the display of a color bar, use the colorbar = false option (or colourbar = false, as a synonym). To force the display of a color bar even with a legend, use the option colorbar = true (or just colorbar or colourbar).
 • The colors of the the contour lines are, by default, chosen to lie on a gradient between the first two colors in the default colors set by plots:-setcolors. The contour lines can be made all the same color by specifiying color=c where c is any supported plot color. To specify different gradients the option colorscheme=s can be used where s is a string giving the name of a color collection, ColorTools:-Palette object (including "reverse" or "shifted" modifiers as described in GetPaletteColors), or a list of colors. (Namely the top two forms of plot,colorscheme but not more complicated colorschemes).
 The colors specified by s are used to create a color gradient using the ColorTools:-Blend command to color the contour lines, or the filled regions (if the filled option is given). If the number of colors given is exactly equal to the number of contours then the contours will be exactly the colors given. When the filled option is given, one more color is needed since the number of filled regions is exactly one more than the number of contours.
 • Legend entries showing the contour values associated with each curve can be controlled with the legend = t option, where t is true, false or a list. When t is not false, a legend entry is displayed for each contour. The option legend on its own is equivalent to legend = true. Legends are available for 2-D plots only and are not displayed by default.
 Custom contour labels and legend entries may be provided. In this case, t must be a list of $n$ expressions, corresponding to the $n$ contour levels ordered from lowest to highest. The labels and legend entries may include arbitrary mathematical expressions. See the plot/typesetting help page for more details.
 Custom contour labels and legend entries that incorporate the contour value or a function of the value can be specified by using the name contourvalue. Here, t can be the name contourvalue itself, a structure contourvalue(p) where p is a procedure, or a typeset structure (as described on the plot/typesetting page) containing either of these as one of its elements. If a procedure p is given, it must take one argument (the contour value) and return a numeric value.
 To evaluate and display numerical values with d digits of precision, t must be a list containing the digits=d suboption. To specify custom contour labels or legend entries in addition to this, place both inside a list so that t has the form [s, digits=d], where s specifies the custom labels.
 • The option filled or filledregion can be used to obtain a filled contour plot. In this case you can also change the default color gradations via the color=c option, where c is a color recognized by plot. See plot/color for information about specifying colors. When a filled contour plot is requested, contour levels provided as a list through the contours option are sorted, if they are not already in increasing or decreasing order.
 • It is also possible to get a three-dimensional version of contour plots via using the plot3d command with style = contour. See plot3d/option. Examples

 > $\mathrm{with}\left(\mathrm{plots}\right):$

Use expressions as input.

 > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),x=-3..3,y=-3..3\right)$ > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right)\right)$ An explicit list of colors of the same size as the number of contours will use those exact colors for the contour lines.

 > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),x=-3..3,y=-3..3,\mathrm{contours}=3,\mathrm{colorscheme}=\left["Red","Green","Blue"\right]\right)$ For a filled plot, an extra color is needed (4 colors for 3 contours), because the it is the areas between the contours being shaded.

 > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),x=-3..3,y=-3..3,\mathrm{contours}=3,\mathrm{filled},\mathrm{colorscheme}=\left["Red","Green","Blue","DarkViolet"\right]\right)$ Explicit values for the contours to be plotted can be specified.

 > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),x=-3..3,y=-3..3,\mathrm{contours}=\left[-\frac{1}{2},\frac{1}{4},\frac{1}{2},\frac{3}{4}\right]\right)$ > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),\mathrm{contours}=\left[-\frac{1}{2},\frac{1}{4},\frac{1}{2},\frac{3}{4}\right]\right)$ If a list of colors smaller than the number of contours is given then coloring will be done by creating a gradient. For filled plots, the color option specifies the colors of the contour lines.

 > $\mathrm{contourplot}\left(-\frac{5x}{{x}^{2}+{y}^{2}+1},x=-3..3,y=-3..3,\mathrm{filledregions}=\mathrm{true},\mathrm{colorscheme}=\left["White","DarkViolet"\right],\mathrm{color}="DarkBlue"\right)$ Use procedures as input.

 > $\mathrm{contourplot}\left(\mathrm{binomial},0..5,0..5\right)$ Specify various coordinate systems.

 > $\mathrm{contourplot}\left({1.3}^{x}\mathrm{sin}\left(y\right),x=-1..2\mathrm{Pi},y=0..\mathrm{Pi},\mathrm{coords}=\mathrm{spherical},\mathrm{grid}=\left[80,80\right]\right)$ Create multiple contour plots.

 > $\mathrm{contourplot}\left(\left\{\mathrm{sin}\left(xy\right),x+2y\right\},x=-\mathrm{Pi}..\mathrm{Pi},y=-\mathrm{Pi}..\mathrm{Pi}\right)$ > $\mathrm{c1}≔\left[\mathrm{cos}\left(x\right)-2\mathrm{cos}\left(0.4y\right),\mathrm{sin}\left(x\right)-2\mathrm{sin}\left(0.4y\right),y\right]$
 ${\mathrm{c1}}{≔}\left[{\mathrm{cos}}{}\left({x}\right){-}{2}{}{\mathrm{cos}}{}\left({0.4}{}{y}\right){,}{\mathrm{sin}}{}\left({x}\right){-}{2}{}{\mathrm{sin}}{}\left({0.4}{}{y}\right){,}{y}\right]$ (1)
 > $\mathrm{c2}≔\left[\mathrm{cos}\left(x\right)+2\mathrm{cos}\left(0.4y\right),\mathrm{sin}\left(x\right)+2\mathrm{sin}\left(0.4y\right),y\right]$
 ${\mathrm{c2}}{≔}\left[{\mathrm{cos}}{}\left({x}\right){+}{2}{}{\mathrm{cos}}{}\left({0.4}{}{y}\right){,}{\mathrm{sin}}{}\left({x}\right){+}{2}{}{\mathrm{sin}}{}\left({0.4}{}{y}\right){,}{y}\right]$ (2)
 > $\mathrm{contourplot}\left(\left\{\mathrm{c1},\mathrm{c2}\right\},x=0..2\mathrm{Pi},y=0..10\right)$ Create plots in polar coordinates, where the underlying coordinate system of the 3-D surface is cylindrical.

 > $\mathrm{contourplot}\left(\left[r,t,\left(r-\frac{1}{r}\right)\mathrm{sin}\left(t\right)-\mathrm{ln}\left(r\right)\right],r=1..4,t=0..2\mathrm{Pi},\mathrm{coords}=\mathrm{cylindrical},\mathrm{contours}=20\right)$ Suppress contour labels which appear when the pointer moves over a curve.

 > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),x=-3..3,y=-3..3,\mathrm{contourlabels}=\mathrm{false},\mathrm{colorscheme}="DivergeBJY"\right)$ Suppress the color bar in the display.

 > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),x=-3..3,y=-3..3,\mathrm{colorbar}=\mathrm{false}\right)$ Specify the precision of the contour labels.

 > $\mathrm{contourplot}\left(x\mathrm{sin}\left(y\right),x,y,\mathrm{contours}=6,\mathrm{contourlabels}=\left[\mathrm{digits}=2\right]\right)$ Provide custom contour labels.

 > $\mathrm{contourplot}\left({x}^{2}+{y}^{2},\mathrm{contours}=\left[\mathrm{seq}\left(i,i=1..4\right)\right],\mathrm{contourlabels}=\left["A","B","C","D"\right]\right)$ Incorporate the contour value into custom contour labels.

 > $\mathrm{contourplot}\left({x}^{2}+{y}^{2},\mathrm{contours}=\left[\mathrm{seq}\left(i,i=1..4\right)\right],\mathrm{contourlabels}=\mathrm{typeset}\left("the circle",{x}^{2}+{y}^{2},"=",\mathrm{contourvalue}\right)\right)$ Display a legend for the contours.

 > $\mathrm{contourplot}\left(\mathrm{sin}\left(xy\right),x=-3..3,y=-3..3,\mathrm{contours}=6,\mathrm{legend}=\mathrm{true}\right)$ Specify the precision of the contour legend entries as well as the legend location.

 > $\mathrm{contourplot}\left(x\mathrm{sin}\left(y\right),x=-1..1,y=-\mathrm{Pi}..\mathrm{Pi},\mathrm{legendstyle}=\left[\mathrm{location}=\mathrm{right}\right],\mathrm{legend}=\left[\mathrm{digits}=2\right],\mathrm{size}=\left[500,400\right],\mathrm{colorscheme}="DivergeRainbow"\right)$ Incorporate the contour value into custom contour labels.

 > $\mathrm{contourplot}\left({x}^{2}+{y}^{2},\mathrm{contours}=\left[\mathrm{seq}\left(i,i=1..4\right)\right],\mathrm{colorscheme}=\left["Orange","Blue"\right],\mathrm{size}=\left[400,500\right],\mathrm{legend}=\mathrm{typeset}\left("the circle",{x}^{2}+{y}^{2},"=",\mathrm{contourvalue}\right)\right)$ The commands to create the plots from the Plotting Guide are

 > $\mathrm{contourplot}\left(-\frac{5x}{{x}^{2}+{y}^{2}+1},x=-3..3,y=-3..3,\mathrm{filledregions}=\mathrm{true}\right)$ > $\mathrm{contourplot3d}\left(-\frac{5x}{{x}^{2}+{y}^{2}+1},x=-3..3,y=-3..3,\mathrm{filledregions}=\mathrm{true}\right)$ > $\mathrm{contourplot3d}\left(-\frac{5x}{{x}^{2}+{y}^{2}+1},x=-3..3,y=-3..3,\mathrm{color}="DarkBlue"\right)$  Compatibility

 • The contourlabels option was introduced in Maple 2017.