add_splines

add_splines#

Plot3d.add_splines(r, t, p, data=None, /, axis=0, dataid='Data', **kwargs)#

Add a bundle of splines through spherical coordinate arrays.

Parameters:
r, t, pArrayLike

N-D coordinate arrays of identical shape. The axis dimension enumerates individual spline paths.

dataArrayLike | None, optional

Scalar values. Default is None (solid color).

axisint, optional

The axis that enumerates distinct splines. Default is 0.

dataidstr, optional

Name for the scalar array. Default is 'Data'.

**kwargs

Additional keyword arguments forwarded to add_mesh().

Returns:
outpyvista.Actor

The rendered spline-bundle actor.

Examples

Ten meridional splines connecting the north and south poles, colored by spline index. Each coordinate array has shape (10, 100). Passing axis=1 declares that axis 1 (length 100) is the fastest-varying dimension — the 100 points that trace each individual path. The remaining axis (or axes in higher-dimensional cases) enumerate distinct splines.

>>> import numpy as np
>>> from pyvisual import Plot3d
>>>
>>> n_lines, n_pts = 10, 100
>>> r = np.tile(5 * np.sin(np.linspace(0, np.pi, n_pts)), (n_lines, 1))
>>> t = np.tile(np.linspace(0, np.pi, n_pts), (n_lines, 1))
>>> p = np.tile(np.linspace(0, 2 * np.pi, n_lines)[:, None], (1, n_pts))
>>> data = np.arange(n_lines)
>>>
>>> plotter = Plot3d()
>>> plotter.show_axes()
>>> plotter.add_sun()
>>> plotter.add_splines(r, t, p, data, axis=1, show_scalar_bar=False)
>>> plotter.show()
../../../../../../_images/pyvisual-core-plot3d-Plot3d-add_splines-3fc5707b6cff38f4_00_00.png