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