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()
https://d33wubrfki0l68.cloudfront.net/b50c34e4e259b264afa5cd11b50005383e2728ec/f31a0/_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()
https://d33wubrfki0l68.cloudfront.net/ede66f1d77c3570583d53f3216d6f453d75f7c19/ab00b/_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()
https://d33wubrfki0l68.cloudfront.net/b0a0db3d61ecec73c32d2ec8439adb86f7eb05cc/b4d1c/_images/pyvista-camera-zoom-1_02_00.png