DataObjectFilters.cell_centers#
- DataObjectFilters.cell_centers( ) PolyData | MultiBlock[source]#
Generate points at the center of the cells in this dataset.
These points can be used for placing glyphs or vectors.
- Parameters:
- Returns:
pyvista.PolyData|pyvista.MultiBlockPoints at the cell centers of the original dataset. Every dataset gives a
PolyData, and aMultiBlockgives aMultiBlockofPolyDatablocks, nested blocks included.
Examples#
Download Python source code | Download Jupyter notebook
>>> import pyvista as pv
>>> mesh = pv.Plane()
>>> mesh.point_data.clear()
>>> centers = mesh.cell_centers()
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(mesh, show_edges=True)
>>> actor = pl.add_points(
... centers,
... render_points_as_spheres=True,
... color='red',
... point_size=20,
... )
>>> pl.show()
Used In#
Guides
- PyVista Data Model (2 uses)
API Examples
DataSet.cell_neighbors(2 uses)DataSet.cell_neighbors_levels(2 uses)DataSet.find_closest_cell(1 use)DataSet.point_cell_ids(1 use)SolidSphere(1 use)
Gallery Examples