spacing#

property UniformGrid.spacing: Tuple[float, float, float]#

Return or set the spacing for each axial direction.

Notes

Spacing must be non-negative. While VTK accepts negative spacing, this results in unexpected behavior. See: https://github.com/pyvista/pyvista/issues/1967

Examples

Create a 5 x 5 x 5 uniform grid.

>>> import pyvista
>>> grid = pyvista.UniformGrid(dims=(5, 5, 5))
>>> grid.spacing
(1.0, 1.0, 1.0)
>>> grid.plot(show_edges=True)
../../../_images/pyvista-UniformGrid-spacing-1_00_00.png

Modify the spacing to (1, 2, 3)

>>> grid.spacing = (1, 2, 3)
>>> grid.plot(show_edges=True)
../../../_images/pyvista-UniformGrid-spacing-1_01_00.png