plot3d(x, y, z, c='index', fig=True, ax=None, returnfig=False, figkwargs=None, axkwargs=None, **kwargs)[source]#

Plot 3D data as a line

  • x (arr) – x coordinate data

  • y (arr) – y coordinate data

  • z (arr) – z coordinate data

  • c (str/tuple) – color, can be an array or any of the types accepted by pl.plot(); if ‘index’ (default), color by index

  • 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

  • figkwargs (dict) – pl.figure()

  • axkwargs (dict) – pl.axes()

  • kwargs (dict) – passed to pl.plot()


x,y,z = pl.rand(3,10)
sc.plot3d(x, y, z)

fig = pl.figure()
n = 100
x = np.array(sorted(pl.rand(n)))
y = x + pl.randn(n)
z = pl.randn(n)
c = np.arange(n)
sc.plot3d(x, y, z, c=c, fig=fig)

New in version 3.1.0: Allow multi-colored line; removed “plotkwargs” argument; “fig” defaults to True