pyvista.Plotter.orbit_on_path

pyvista.Plotter.orbit_on_path#

Plotter.orbit_on_path(
path=None,
focus=None,
step=0.5,
viewup=None,
write_frames=False,
threaded=False,
progress_bar=False,
)[source]#

Orbit on the given path focusing on the focus point.

Parameters:
pathpyvista.PolyData

Path of orbital points. The order in the points is the order of travel.

focussequence[float], optional

The point of focus the camera. For example (0.0, 0.0, 0.0).

stepfloat, default: 0.5

The timestep between flying to each camera position. Ignored when plotter.off_screen = True.

viewupsequence[float], optional

The normal to the orbital plane.

write_framesbool, default: False

Assume a file is open and write a frame on each camera view during the orbit.

threadedbool, default: False

Run this as a background thread. Generally used within a GUI (i.e. PyQt).

progress_barbool, default: False

Show the progress bar when proceeding through the path. This can be helpful to show progress when generating movies with off_screen=True.

Examples

Plot an orbit around the earth. Save the gif as a temporary file.

>>> from pathlib import Path
>>> from tempfile import mkdtemp
>>> import pyvista as pv
>>> from pyvista import examples
>>> mesh = examples.load_globe()
>>> texture = examples.load_globe_texture()
>>> filename = Path(mkdtemp()) / 'orbit.gif'
>>> plotter = pv.Plotter(window_size=[300, 300])
>>> _ = plotter.add_mesh(
...     mesh, texture=texture, smooth_shading=True
... )
>>> plotter.open_gif(filename)
>>> viewup = [0, 0, 1]
>>> orbit = plotter.generate_orbital_path(
...     factor=2.0, n_points=24, shift=0.0, viewup=viewup
... )
>>> plotter.orbit_on_path(
...     orbit, write_frames=True, viewup=viewup, step=0.02
... )

See Orbiting for a full example using this method.

../../../_images/pyvista-Plotter-orbit_on_path-1_00_00.gif