pyvista.Camera.zoom#

Camera.zoom(value)[source]#

Set the zoom of the camera.

In perspective mode, decrease the view angle by the specified factor.

In parallel mode, decrease the parallel scale by the specified factor. A value greater than 1 is a zoom-in, a value less than 1 is a zoom-out.

Parameters:
valuefloat or str

Zoom of the camera. If a float, must be greater than 0. Otherwise, if a string, must be "tight". If tight, the plot will be zoomed such that the actors fill the entire viewport.

Examples

Show the Default zoom.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(pv.Sphere())
>>> pl.camera.zoom(1.0)
>>> pl.show()
../../../_images/pyvista-Camera-zoom-1_00_00.png

Show 2x zoom.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(pv.Sphere())
>>> pl.camera.zoom(2.0)
>>> pl.show()
../../../_images/pyvista-Camera-zoom-1_01_00.png

Zoom so the actor fills the entire render window.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(pv.Sphere())
>>> pl.camera.zoom('tight')
>>> pl.show()
../../../_images/pyvista-Camera-zoom-1_02_00.png