lines_from_points

lines_from_points#

lines_from_points(
points: VectorLikeFloat | MatrixLikeFloat,
*,
close: bool = False,
) → PolyData[source]#

Make a connected line set given an array of points.

Parameters:
pointsVectorLikeFloat | MatrixLikeFloat

Points representing the vertices of the connected segments. For example, two line segments would be represented as np.array([[0, 0, 0], [1, 0, 0], [1, 1, 0]]).

closebool, default: False

If True, close the line segments into a loop.

Returns:
pyvista.PolyData

PolyData with lines and cells.

Examples#

Download Python source code | Download Jupyter notebook

>>> import numpy as np
>>> import pyvista as pv
>>> points = np.array([[0, 0, 0], [1, 0, 0], [1, 1, 0]])
>>> poly = pv.lines_from_points(points)
>>> poly.plot(line_width=5)
../../../_images/pyvista-lines_from_points-6cfa27105270b28b_00_00.png

See Also#

pyvista.PolyDataFilters.dash_lines

Split the line cells into dashes.

pyvista.PolyDataFilters.tube

Generate a tube around each line.

pyvista.Actor.line_style

Dash the lines while rendering them.