surf3d#
- surf3d(x=None, y=None, z=None, c='z', fig=True, ax=None, returnfig=False, colorbar=None, figkwargs=None, axkwargs=None, **kwargs)[source]#
Plot 2D or 3D data as a 3D surface
Typically,
x
,y
, andz
, are all 2D arrays of the same size. However, if a single 2D array is provided, then this will be treated asz
values andx
andy
will be inferred on a grid (or they can be provided explicitly, either as vectors or 2D arrays).- Parameters:
x (arr) – 1D or 2D array of x coordinates (or z-coordinate data if 2D and
z
isNone
)y (arr) – 1D or 2D array of y coordinates (optional)
z (arr) – 2D array of z coordinates
c (arr) – color data; defaults to match z
fig (fig) – an existing figure to draw the plot in (or set to True to create a new figure)
ax (axes) – an existing axes to draw the plot in
returnfig (bool) – whether to return the figure, or just the axes
colorbar (bool) – whether to plot a colorbar (true by default unless color data is provided)
figkwargs (dict) – passed to
pl.figure()
kwargs (dict) – passed to
ax.plot_surface()
Examples:
# Simple example data = sc.smooth(pl.rand(30,50)) sc.surf3d(data) # Use non-default axes and colors nx = 20 ny = 50 x = 10*np.arange(nx) y = np.arange(ny) + 100 z = sc.smooth(pl.randn(ny,nx)) c = z**2 sc.surf3d(x=x, y=y, z=z, c=c, cmap='orangeblue')
New in 3.1.0: updated arguments from “data” to x, y, z, c; removed “plotkwargs” argument; “fig” defaults to True