pyvista.Plotter.add_arrows#

Plotter.add_arrows(cent, direction, mag=1, **kwargs)[source]#

Add arrows to the plotter.

Parameters:
centnp.ndarray

Array of centers.

directionnp.ndarray

Array of direction vectors.

magfloat, optional

Amount to scale the direction vectors.

**kwargsdict, optional

See pyvista.Plotter.add_mesh() for optional keyword arguments.

Returns:
pyvista.Actor

Actor of the arrows.

Examples

Plot a random field of vectors and save a screenshot of it.

>>> import numpy as np
>>> import pyvista as pv
>>> rng = np.random.default_rng(seed=0)
>>> cent = rng.random((10, 3))
>>> direction = rng.random((10, 3))
>>> plotter = pv.Plotter()
>>> _ = plotter.add_arrows(cent, direction, mag=2)
>>> plotter.show()
../../../_images/pyvista-Plotter-add_arrows-1_00_00.png