pyvista.Chart2D.scatter

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.

colorColorLike, default: “b”

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

sizefloat, default: 10

Size of the point markers drawn in this plot.

stylestr, default: “o”

Style of the point markers drawn in this plot. See ScatterPlot2D.MARKER_STYLES for a list of allowed marker styles.

labelstr, 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()
../../../../_images/pyvista-Chart2D-scatter-2_00_00.png