ListPlot3D

ListPlot3D[array]

generates a three-dimensional plot of a surface representing an array of height values.

ListPlot3D[{{x1,y1,z1},{x2,y2,z2},}]

generates a plot of the surface with heights zi at positions {xi,yi}.

ListPlot3D[{data1,data2,}]

plots the surfaces corresponding to each of the datai.

Details and Options

  • Data values xi, yi and zi can be given in the following forms:
  • xia real-valued number
    Quantity[xi,unit]a quantity with a unit
  • Values xi, yi and zi that are not of the preceding form are taken to be missing and are not shown.
  • The datai have the following forms and interpretations:
  • <|"k1"{x1,y1,z1},"k2"{x2,y2,z2},|>values {{x1,y1,z1},{x2,y2,z2},}
    SparseArrayvalues as a normal array
    QuantityArraymagnitudes
    WeightedDataunweighted values
  • The following wrappers w can be used for the datai:
  • Annotation[datai,label]provide an annotation for the data
    Button[datai,action]define an action to execute when the data is clicked
    Callout[datai,label]label the data with a callout
    Callout[datai,label,pos]place the callout at relative position pos
    EventHandler[datai,]define a general event handler for the data
    Hyperlink[datai,uri]make the data a hyperlink
    Labeled[datai,label]label the data
    Labeled[datai,label,pos]place the label at relative position pos
    Legended[datai,label]identify the data in a legend
    PopupWindow[datai,cont]attach a popup window to the data
    StatusArea[datai,label]display in the status area on mouseover
    Style[datai,styles]show the data using the specified styles
    Tooltip[datai,label]attach a tooltip to the data
    Tooltip[datai]use data values as tooltips
  • Wrappers w can be applied at multiple levels:
  • w[datai]wrap the data
    w[{data1,}]wrap a collection of datai
    w1[w2[]]use nested wrappers
  • Callout, Labeled and Placed can use the following positions pos:
  • Automaticautomatically placed labels
    Above, Below, Before, Afterpositions around the surface
    {x,y}near the surface at a position {x,y}
    {x,y,z}at the position {x,y,z}
    {s,Above},{s,Below},relative position at position s around the surface
    {pos,epos}epos in label placed at relative position pos of the surface
  • ListPlot3D has the same options as Graphics3D, with the following additions and changes:
  • AxesTruewhether to draw axes
    BoundaryStyleAutomatichow to draw boundary lines for surfaces
    BoxRatios{1,1,0.4}bounding 3D box ratios
    ClippingStyleAutomatichow to draw clipped parts of the surface
    ColorFunctionAutomatichow to determine the color of surfaces
    ColorFunctionScalingTruewhether to scale arguments to ColorFunction
    DataRangeAutomaticthe range of and values to assume for data
    FillingNonefilling under the surface
    FillingStyleOpacity[0.5]style to use for filling
    InterpolationOrderNonethe polynomial degree in each variable of surfaces used in joining data points
    LabelingSizeAutomaticsize to use for callout and label
    MaxPlotPointsAutomaticthe maximum number of points to include
    MeshAutomatichow many mesh lines in each direction to draw
    MeshFunctions{#1&,#2&}how to determine the placement of mesh lines
    MeshShadingNonehow to shade regions between mesh lines
    MeshStyleAutomaticthe style for mesh lines
    MethodAutomaticthe method to use for interpolation and data reduction
    NormalsFunctionAutomatichow to determine effective surface normals
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotLabelsNonelabels to use for surfaces
    PlotLegendsNonelegends for surfaces
    PlotRange{Full,Full,Automatic}the range of or other values to include
    PlotRangePaddingAutomatichow much to pad the range of values
    PlotStyleAutomaticgraphics directives to specify the style for the surface
    PlotTheme$PlotThemeoverall theme for the plot
    RegionFunction(True&)how to determine whether a point should be included
    ScalingFunctionsNonehow to scale individual coordinates
    TextureCoordinateFunctionAutomatichow to determine texture coordinates
    TextureCoordinateScalingTruewhether to scale arguments to TextureCoordinateFunction
    VertexColorsAutomaticcolors to assume at each point
    VertexNormalsAutomaticeffective normals to assume at each point
  • In ListPlot3D[array], array must be a rectangular array. Each element can be either a single real number representing a value, or an triple.
  • There will be holes in the surface corresponding to array elements that do not represent explicit height values.
  • ListPlot3D[array] by default takes the and coordinate values for each data point to be successive integers starting at 1.
  • The elements of array can also be triples {x11,y11,z11}, specifying heights zij at explicit positions {xij,yij}. The connectivity of the surface in this case is still taken to follow the 2D array.
  • In the default case with no explicit and given, the setting DataRange->{{xmin,xmax},{ymin,ymax}} specifies the ranges of coordinate values to use.
  • With the default setting DataRange->Automatic, ListPlot3D[{{a11,a12,a13},,{an1,an2,an3}}] will assume that the data being given is {{x1,y1,z1},}, rather than an ×3 array of height values.
  • ListPlot3D[list,DataRange->All] always takes list to represent an array of height values.
  • Possible settings for ScalingFunctions include:
  • szscale the z axis
    {sx,sy}scale x and y axes
    {sx,sy,sz}scale x, y and z axes
  • Each scaling function si is either a string "scale" or {g,g-1}, where g-1 is the inverse of g.
  • For ListPlot3D[array], Mesh->Full draws a mesh that crosses at the position of each data point.
  • array can be a SparseArray object.
  • The arguments supplied to functions in MeshFunctions and RegionFunction are , , and . Functions in ColorFunction and TextureCoordinateFunction are by default supplied with scaled versions of these arguments.
  • The setting for VertexColors must be an array or list with the same structure as the coordinate data.
  • An explicit setting for VertexColors overrides colors determined from ColorFunction.
  • ListPlot3D returns Graphics3D[data].
  • Themes that affect 3D surfaces include:
  • "DarkMesh"dark mesh lines
    "GrayMesh"gray mesh lines
    "LightMesh"light mesh lines
    "ZMesh"vertically distributed mesh lines
    "ThickSurface"add thickness to surfaces
    "FilledSurface"add filling below surfaces

Examples

open all close all

Basic Examples  (3)

Use an array of values to define heights for a surface:

In[1]:=
Click for copyable input
Out[1]=

Give explicit , , coordinates for points on a surface:

In[1]:=
Click for copyable input
Out[1]=

Use different interpolations of data:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Scope  (24)

Options  (110)

Applications  (5)

Properties & Relations  (14)

Possible Issues  (2)

Neat Examples  (2)

Introduced in 1988
(1.0)
|
Updated in 2019
(12.0)