Line#

Line(
pointa: VectorLikeFloat = (-0.5, 0.0, 0.0),
pointb: VectorLikeFloat = (0.5, 0.0, 0.0),
*,
resolution: int = 1,
) → PolyData[source]#

Create a line.

Parameters:
pointaVectorLikeFloat, default: (-0.5, 0.0, 0.0)

Location in [x, y, z].

pointbVectorLikeFloat, default: (0.5, 0.0, 0.0)

Location in [x, y, z].

resolutionint, default: 1

Number of pieces to divide line into.

Returns:
pyvista.PolyData

Line mesh.

Examples#

Download Python source code | Download Jupyter notebook

Create a line between (0, 0, 0) and (0, 0, 1).

>>> import pyvista as pv
>>> mesh = pv.Line((0, 0, 0), (0, 0, 1))
>>> mesh.plot(color='k', line_width=10)
../../../_images/pyvista-Line-5eba6daa60c37df5_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.