pyvista.examples.cells.PolyLine

Contents

pyvista.examples.cells.PolyLine#

PolyLine() UnstructuredGrid[source]#

Create a pyvista.UnstructuredGrid containing a single poly line.

This represents a set of line segments as a single cell.

This cell corresponds to the pyvista.CellType.POLY_LINE cell type.

Returns:
pyvista.UnstructuredGrid

UnstructuredGrid containing a single polyline.

Examples

Create and plot a single polyline.

>>> from pyvista import examples
>>> grid = examples.cells.PolyLine()
>>> examples.plot_cell(grid)

List the grid’s cells. This could be any number of points.

>>> grid.cells
array([4, 0, 1, 2, 3])

List the grid’s points.

>>> grid.points
pyvista_ndarray([[0. , 0. , 0. ],
                 [0.5, 0. , 0. ],
                 [0.5, 1. , 0. ],
                 [0. , 1. , 0. ]])
>>> grid.celltypes  # same as pyvista.CellType.POLY_LINE
array([4], dtype=uint8)
../../../_images/pyvista-examples-cells-PolyLine-1_00_00.png