PolyLine#
- PolyLine() UnstructuredGrid[source]#
Create a
pyvista.UnstructuredGridcontaining a single poly line.This represents a set of line segments as a single cell.
This cell corresponds to the
pyvista.CellType.POLY_LINEcell type.- Returns:
pyvista.UnstructuredGridUnstructuredGrid containing a single polyline.
Examples#
Download Python source code | Download Jupyter notebook
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)