pyvista.Plotter.set_scale#

Plotter.set_scale(xscale=None, yscale=None, zscale=None, reset_camera=True, render=True)[source]#

Scale all the actors in the scene.

Scaling in performed independently on the X, Y and Z axis. A scale of zero is illegal and will be replaced with one.

Warning

Setting the scale on the renderer is a convenience method to individually scale each of the actors in the scene. If a scale was set on an actor previously, it will be reset to the scale of this Renderer.

Parameters:
xscalefloat, optional

Scaling in the x direction. Default is None, which does not change existing scaling.

yscalefloat, optional

Scaling in the y direction. Default is None, which does not change existing scaling.

zscalefloat, optional

Scaling in the z direction. Default is None, which does not change existing scaling.

reset_camerabool, default: True

Resets camera so all actors can be seen.

renderbool, default: True

If the render window is being shown, trigger a render after setting the scale.

Examples

Set the scale in the z direction to be 2 times that of nominal. Leave the other axes unscaled.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> pl.set_scale(zscale=2)
>>> _ = pl.add_mesh(pv.Sphere())  # perfect sphere
>>> pl.show()
../../../_images/pyvista-Plotter-set_scale-1_00_00.png