pyvista.Chart2D.line#

Chart2D.line(x, y, color='b', width=1.0, style='-', label='')[source]#

Add a line plot to this chart.

Parameters:
xarray_like

X coordinates of the points through which a line should be drawn.

yarray_like

Y coordinates of the points through which a line should be drawn.

colorColorLike, default: “b”

Color of the line drawn in this plot. Any color parsable by pyvista.Color is allowed.

widthfloat, default: 1

Width of the line drawn in this plot.

stylestr, default: “-”

Style of the line drawn in this plot. See Pen.LINE_STYLES for a list of allowed line styles.

labelstr, default: “”

Label of this plot, as shown in the chart’s legend.

Returns:
plotting.charts.LinePlot2D

The created line plot.

Examples

Generate a line plot.

>>> import pyvista as pv
>>> chart = pv.Chart2D()
>>> plot = chart.line([0, 1, 2], [2, 1, 3])
>>> chart.show()
../../../../_images/pyvista-Chart2D-line-2_00_00.png