pyvista.StructuredGrid.hide_cells#

StructuredGrid.hide_cells(ind, inplace=False)[source]#

Hide cells without deleting them.

Hides cells by setting the ghost_cells array to HIDDEN_CELL.

Parameters:
indsequence[int]

List or array of cell indices to be hidden. The array can also be a boolean array of the same size as the number of cells.

inplacebool, default: False

Updates mesh in-place.

Returns:
pyvista.StructuredGrid

Structured grid with hidden cells.

Examples

Hide part of the middle of a structured surface.

>>> import pyvista as pv
>>> import numpy as np
>>> x = np.arange(-10, 10, 0.25)
>>> y = np.arange(-10, 10, 0.25)
>>> z = 0
>>> x, y, z = np.meshgrid(x, y, z)
>>> grid = pv.StructuredGrid(x, y, z)
>>> grid = grid.hide_cells(range(79 * 30, 79 * 50))
>>> grid.plot(color=True, show_edges=True)
../../../_images/pyvista-StructuredGrid-hide_cells-1_00_00.png