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.

colorcolor_like, optional

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

widthfloat, optional

Width of the line drawn in this plot. Defaults to 1.

stylestr, optional

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

labelstr, optional

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

Returns:
plotting.charts.LinePlot2D

The created line plot.

Examples

Generate a line plot.

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