mpl_toolkits.mplot3d.axes3d.Axes3D.plot_surface#

Axes3D.plot_surface(X, Y, Z, *, norm=None, vmin=None, vmax=None, lightsource=None, axlim_clip=False, **kwargs)[source]#

Create a surface plot.

By default, it will be colored in shades of a solid color, but it also supports colormapping by supplying the cmap argument.

Note

The rcount and ccount kwargs, which both default to 50, determine the maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points.

Note

To maximize rendering speed consider setting rstride and cstride to divisors of the number of rows minus 1 and columns minus 1 respectively. For example, given 51 rows rstride can be any of the divisors of 50.

Similarly, a setting of rstride and cstride equal to 1 (or rcount and ccount equal the number of rows and columns) can use the optimized path.

Parameters:
X, Y, Z2D arrays

Data values.

rcount, ccountint

Maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Defaults to 50.

rstride, cstrideint

Downsampling stride in each direction. These arguments are mutually exclusive with rcount and ccount. If only one of rstride or cstride is set, the other defaults to 10.

'classic' mode uses a default of rstride = cstride = 10 instead of the new default of rcount = ccount = 50.

colorcolor

Color of the surface patches.

cmapColormap, optional

Colormap of the surface patches.

facecolorslist of color

Colors of each individual patch.

normNormalize, optional

Normalization for the colormap.

vmin, vmaxfloat, optional

Bounds for the normalization.

shadebool, default: True

Whether to shade the facecolors. Shading is always disabled when cmap is specified.

lightsourceLightSource, optional

The lightsource to use when shade is True.

axlim_clipbool, default: False

Whether to hide patches with a vertex outside the axes view limits.

Added in version 3.10.

**kwargs

Other keyword arguments are forwarded to Poly3DCollection.

Examples using mpl_toolkits.mplot3d.axes3d.Axes3D.plot_surface#

Project contour profiles onto a graph

Project contour profiles onto a graph

Project filled contour onto a graph

Project filled contour onto a graph

Custom hillshading in a 3D surface plot

Custom hillshading in a 3D surface plot

2D images in 3D

2D images in 3D

2D and 3D Axes in same figure

2D and 3D Axes in same figure

Automatic text offsetting

Automatic text offsetting

3D plots as subplots

3D plots as subplots

3D surface (colormap)

3D surface (colormap)

3D surface (solid color)

3D surface (solid color)

3D surface (checkerboard)

3D surface (checkerboard)

3D surface with polar coordinates

3D surface with polar coordinates

plot_surface(X, Y, Z)

plot_surface(X, Y, Z)