add_lines#

Plotter.add_lines(lines, color='w', width=5, label=None, name=None)#

Add lines to the plotting object.

Parameters:
linesnp.ndarray or pyvista.PolyData

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

colorcolor_like, optional

Either a string, rgb list, or hex color string. For example:

  • color='white'

  • color='w'

  • color=[1.0, 1.0, 1.0]

  • color='#FFFFFF'

widthfloat, optional

Thickness of lines.

labelstr, optional

String label to use when adding a legend to the scene with pyvista.BasePlotter.add_legend().

namestr, optional

The name for the added actor so that it can be easily updated. If an actor of this name already exists in the rendering window, it will be replaced by the new actor.

Returns:
vtk.vtkActor

Lines actor.

Examples

>>> import numpy as np
>>> import pyvista
>>> pl = pyvista.Plotter()
>>> points = np.array([[0, 1, 0], [1, 0, 0], [1, 1, 0], [2, 0, 0]])
>>> actor = pl.add_lines(points, color='yellow', width=3)
>>> pl.camera_position = 'xy'
>>> pl.show()
../../../_images/pyvista-Plotter-add_lines-1_00_00.png