Note
Go to the end to download the full example code. or to run this example in your browser via Binder
Orbiting#
Orbit around a scene.
Note
The quality of the movie will be better when using
pl.open_movie('orbit.mp4')
instead of
pl.open_gif('orbit.gif')
For orbiting to work you first have to show the scene and leave the plotter open
with .show(auto_close=False)
. You may also have to set
pv.Plotter(off_screen=True)
Note
Use lighting=False
to reduce the size of the color space to avoid
“jittery” GIFs when showing the scalar bar.
import pyvista as pv
from pyvista import examples
mesh = examples.download_st_helens().warp_by_scalar()
Orbit around the Mt. St Helens dataset.
pl = pv.Plotter()
pl.add_mesh(mesh, lighting=False)
pl.camera.zoom(1.5)
pl.show(auto_close=False)
path = pl.generate_orbital_path(n_points=36, shift=mesh.length)
pl.open_gif("orbit.gif")
pl.orbit_on_path(path, write_frames=True)
pl.close()

pl = pv.Plotter()
pl.add_mesh(mesh, lighting=False)
pl.show_grid()
pl.show(auto_close=False)
viewup = [0.5, 0.5, 1]
path = pl.generate_orbital_path(factor=2.0, shift=10000, viewup=viewup, n_points=36)
pl.open_gif("orbit.gif")
pl.orbit_on_path(path, write_frames=True, viewup=[0, 0, 1], step=0.05)
pl.close()

pl = pv.Plotter()
pl.add_mesh(mesh)
pl.show(auto_close=False)
path = pl.generate_orbital_path(factor=2.0, n_points=36, viewup=viewup, shift=0.2)
pl.open_gif("orbit.gif")
pl.orbit_on_path(path, write_frames=True, viewup=viewup, step=0.05)
pl.close()

Total running time of the script: (0 minutes 57.603 seconds)