pyvista.Renderer.viewport

pyvista.Renderer.viewport#

property Renderer.viewport[source]#

Viewport of the renderer.

Viewport describes the (xstart, ystart, xend, yend) square of the renderer relative to the main renderer window.

For example, a renderer taking up the entire window will have a viewport of (0.0, 0.0, 1.0, 1.0), while the viewport of a renderer on the left-hand side of a horizontally split window would be (0.0, 0.0, 0.5, 1.0).

Returns:
tuple

Viewport in the form (xstart, ystart, xend, yend).

Examples

Show the viewport of a renderer taking up half the render window.

>>> import pyvista as pv
>>> pl = pv.Plotter(shape=(1, 2))
>>> _ = pl.add_mesh(pv.Sphere())
>>> pl.renderers[0].viewport
(0.0, 0.0, 0.5, 1.0)

Change viewport to half size.

>>> pl.renderers[0].viewport = (0.125, 0.25, 0.375, 0.75)
>>> pl.show()
../../../_images/pyvista-Renderer-viewport-1_00_00.png