pyvista.Chart2D.scatter#
- Chart2D.scatter(x, y, color='b', size=10, style='o', label='')[source]#
Add a scatter plot to this chart.
- Parameters:
- xarray_like
X coordinates of the points to draw.
- yarray_like
Y coordinates of the points to draw.
- color
ColorLike
, default: “b” Color of the points drawn in this plot. Any color parsable by
pyvista.Color
is allowed.- size
float
, default: 10 Size of the point markers drawn in this plot.
- style
str
, default: “o” Style of the point markers drawn in this plot. See ScatterPlot2D.MARKER_STYLES for a list of allowed marker styles.
- label
str
, default: “” Label of this plot, as shown in the chart’s legend.
- Returns:
plotting.charts.ScatterPlot2D
The created scatter plot.
Examples
Generate a scatter plot.
>>> import pyvista as pv >>> chart = pv.Chart2D() >>> plot = chart.scatter([0, 1, 2], [2, 1, 3]) >>> chart.show()