_StructuredDataMixin.extent

_StructuredDataMixin.extent#

property _StructuredDataMixin.extent: tuple[int, int, int, int, int, int][source]#

Return or set the extent of the grid.

The extent is simply the first and last indices for each of the three axes. It encodes information about the grid’s offset and dimensions, and setting it is subject to the same constraints on the dimensions.

Changed in version 0.50: Available on RectilinearGrid, StructuredGrid and ExplicitStructuredGrid.

Examples#

Download Python source code | Download Jupyter notebook

Create an ImageData and show its extent.

>>> import pyvista as pv
>>> grid = pv.ImageData(dimensions=(10, 10, 10))
>>> grid.extent
(0, 9, 0, 9, 0, 9)
>>> grid.extent = (2, 5, 2, 5, 2, 5)
>>> grid.extent
(2, 5, 2, 5, 2, 5)

For an ImageData, this also modifies the offset, dimensions, and bounds. Since we use default spacing of 1 here, the bounds match the extent exactly.

>>> grid.offset
(2, 2, 2)
>>> grid.dimensions
(4, 4, 4)
>>> grid.bounds
BoundsTuple(x_min = 2.0,
            x_max = 5.0,
            y_min = 2.0,
            y_max = 5.0,
            z_min = 2.0,
            z_max = 5.0)