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.
- color
ColorLike
, default: “b” Color of the line drawn in this plot. Any color parsable by
pyvista.Color
is allowed.- width
float
, default: 1 Width of the line drawn in this plot.
- style
str
, default: “-” Style of the line drawn in this plot. See Pen.LINE_STYLES for a list of allowed line styles.
- label
str
, 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()