ScatterPlot3D - Maple Help

Statistics

 ScatterPlot3D
 generate 3D scatter plots

 Calling Sequence ScatterPlot3D(XYZ, options, plotoptions)

Parameters

 XYZ - Array or Matrix of numeric data, of size mx3 options - (optional) equation(s) of the form option=value where option is one of lowess, bandwidth, fitorder, rule, strictorder, or showpoints; specify options for generating the scatter plot plotoptions - options to be passed to the plots[display] command

Options

 The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See plot[options] for details.
 • lowess=truefalse
 Designates whether lowess smoothing should be applied to the scatter plot. The smoothing behavior is modified by the options bandwidth, fitorder, rule, and strictorder; see these options for more details. The default value is false.
 • bandwidth=realcons
 This option is used to control the bandwidth of the lowess smoothing algorithm, when lowess fitting is enabled. The value of this option specifies the proportion of the data points used in each local regression. The default value depends on fitorder and the total number of data points. At the value of $\mathrm{bandwidth}=1$ all data points in the sample will be used to compute each plotted grid value, which is quite expensive and not really in the spirit of lowess smoothing. As this value is decreased, fewer data points will be found within the window and used for each individual local fit, and this will decrease the duration of the whole computation. As this value is increased, more points farther away will influence the output value for each local fit, and this will also increase the duration of the whole computation.
 • fitorder=nonnegint
 The degree of the bivariate polynomial used in lowess smoothing, when lowess fitting is enabled. The default value is $1$.
 • rule=identical(1,2,3)
 Designates the rule by which the nearby points falling in the window specified by bandwidth are weighted. The default value is $3$ , which denotes the tri-cubed rule. A value of 0 for this option means that all points found in the window will have the same weight.
 • strictorder=truefalse
 Designates whether the order of the fitting curve may not be reduced in the case that the number of points found in the window is less than what would be necessary for the supplied fitorder option. The default value is false, which allows reduction of the order at any individual computed point.
 • showpoints=truefalse
 Designates whether the pointplot component will be included in the output. If false then only the surface will be included. The default value is true.

Description

 • The ScatterPlot3D command generates a 3D scatter plot for the specified 2D data together with a surface approximated using lowess smoothing (LOcally Weighted Scatterplot Smoothing).
 • The first parameter, XYZ, is the data sample - given as a Matrix or Array with three columns and as many rows as there are distinct data points. Each row represents the x-, y-, and z-coordinate of a data point.
 • The collection of x- and y-components of all the data points need not collectively form a regular grid in the x-y plane. The data points may be irregularly spaced when projected onto the x-y plane.
 • As this is a smoothing technique, the resulting surface will not necessarily pass exactly through all the the 3D data points.

Examples

First, some data is constructed and noise is then added to the z-component.

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $X≔\mathrm{Sample}\left(\mathrm{Uniform}\left(-50,50\right),175\right):$
 > $Y≔\mathrm{Sample}\left(\mathrm{Uniform}\left(-50,50\right),175\right):$
 > $\mathrm{Zerror}≔\mathrm{Sample}\left(\mathrm{Normal}\left(0,100\right),175\right):$
 > $Z≔\mathrm{Array}\left(1..175,i↦-\mathrm{sin}\left(\frac{Y\left[i\right]}{20}\right)\cdot {\left(X\left[i\right]-6\right)}^{2}-{\left(Y\left[i\right]-7\right)}^{2}-\mathrm{Zerror}\left[i\right]\right):$
 > $\mathrm{XYZ}≔{\mathrm{Matrix}\left(\left[\left[X\right],\left[Y\right],\left[Z\right]\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)}^{\mathrm{%T}}$
 ${\mathrm{XYZ}}{≔}\begin{array}{c}\left[\begin{array}{ccc}{31.4723686393179}& {-33.1009970537296}& {-1012.46241273235}\\ {40.5791937075619}& {14.9115474956452}& {-806.039227028612}\\ {-37.3013183706494}& {23.1722385658670}& {-2015.90495680120}\\ {41.3375856139019}& {14.7745963136307}& {-820.929248581064}\\ {13.2359246225409}& {-4.90762935690551}& {-84.2771018915033}\\ {-40.2459595000590}& {4.70088922863449}& {-550.870468949330}\\ {-22.1501781132952}& {-20.3679194392227}& {-51.7815989264864}\\ {4.68815192049838}& {24.4692807074156}& {-249.974807397298}\\ {45.7506835434298}& {-31.1044984967455}& {222.309146641398}\\ {46.4888535199277}& {18.6775433365315}& {-1499.89028342832}\\ {⋮}& {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{175 × 3 Matrix}}\end{array}$ (1)

The view from above shows the irregular spacing of the x-y components of the data.

 > $\mathrm{ScatterPlot3D}\left(\mathrm{XYZ},\mathrm{axes}=\mathrm{box},\mathrm{orientation}=\left[20,0,0\right]\right)$

A fitting order of 0 produces a form of weighted moving average.

 > $\mathrm{ScatterPlot3D}\left(\mathrm{XYZ},\mathrm{lowess},\mathrm{fitorder}=0,\mathrm{rule}=0,\mathrm{grid}=\left[25,25\right],\mathrm{axes}=\mathrm{box},\mathrm{orientation}=\left[20,70,0\right]\right)$

Linear or quadratic fitting, with a fitting order of 1 or 2 respectively, produce smoother plots.

 > $\mathrm{ScatterPlot3D}\left(\mathrm{XYZ},\mathrm{lowess},\mathrm{fitorder}=1,\mathrm{rule}=2,\mathrm{grid}=\left[25,25\right],\mathrm{axes}=\mathrm{box},\mathrm{orientation}=\left[20,70,0\right]\right)$
 > $\mathrm{ScatterPlot3D}\left(\mathrm{XYZ},\mathrm{lowess},\mathrm{fitorder}=1,\mathrm{rule}=2,\mathrm{showpoints}=\mathrm{false},\mathrm{grid}=\left[25,25\right],\mathrm{axes}=\mathrm{box},\mathrm{orientation}=\left[20,70,0\right]\right)$
 > $\mathrm{ScatterPlot3D}\left(\mathrm{XYZ},\mathrm{lowess},\mathrm{fitorder}=2,\mathrm{rule}=3,\mathrm{grid}=\left[25,25\right],\mathrm{axes}=\mathrm{box},\mathrm{orientation}=\left[20,70,0\right]\right)$

Compatibility

 • The Statistics[ScatterPlot3D] command was introduced in Maple 16.