scatter3d#
- class scatter3d(x, y=None, z=None, c='z', fig=None, ax=None, returnfig=False, figkwargs=None, axkwargs=None, plotkwargs=None, **kwargs)[source]#
Plot 3D data as a scatter
Typically,
x
,y
, andz
, are all vectors. However, if a single 2D array is provided, then this will be treated asz
values andx
andy
will be inferred on a grid.- Parameters:
x (arr) – x coordinate data (or z-coordinate data if 2D and
z
isNone
)y (arr) – y coordinate data
z (arr) – z coordinate data
c (arr) – color data; defaults to match z, explicitly pass
c=None
to use default colorsfig (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
figkwargs (dict) – passed to figure()
axkwargs (dict) – passed to axes()
plotkwargs (dict) – passed to plot()
kwargs (dict) – also passed to plot()
Examples:
# Explicit coordinates x,y,z = np.random.rand(3,50) sc.scatter3d(x, y, z) # Implicit coordinates data = np.random.randn(10, 10) sc.scatter3d(data)
New in version 3.0.0: allow 2D input.