ScatterPlotItem

class pyqtgraph.ScatterPlotItem(*args, **kargs)[source]

Displays a set of x/y points. Instances of this class are created automatically as part of PlotDataItem; these rarely need to be instantiated directly.

The size, shape, pen, and fill brush may be set for each point individually or for all points.

Signals:  
sigPlotChanged(self) Emitted when the data being plotted has changed
sigClicked(self, points) Emitted when the curve is clicked. Sends a list of all the points under the mouse pointer.
__init__(*args, **kargs)[source]

Accepts the same arguments as setData()

addPoints(*args, **kargs)[source]

Add new points to the scatter plot. Arguments are the same as setData()

clear()[source]

Remove all spots from the scatter plot

setBrush(*args, **kargs)[source]

Set the brush(es) used to fill the interior of each spot. If a list or array is provided, then the brush for each spot will be set separately. Otherwise, the arguments are passed to pg.mkBrush and used as the default brush for all spots which do not have a brush explicitly set.

setData(*args, **kargs)[source]

Ordered Arguments:

  • If there is only one unnamed argument, it will be interpreted like the ‘spots’ argument.
  • If there are two unnamed arguments, they will be interpreted as sequences of x and y values.
Keyword Arguments:  
spots Optional list of dicts. Each dict specifies parameters for a single spot: {‘pos’: (x,y), ‘size’, ‘pen’, ‘brush’, ‘symbol’}. This is just an alternate method of passing in data for the corresponding arguments.
x,*y* 1D arrays of x,y values.
pos 2D structure of x,y pairs (such as Nx2 array or list of tuples)
pxMode If True, spots are always the same size regardless of scaling, and size is given in px. Otherwise, size is in scene coordinates and the spots scale with the view. Default is True
symbol can be one (or a list) of: * ‘o’ circle (default) * ‘s’ square * ‘t’ triangle * ‘d’ diamond * ‘+’ plus * any QPainterPath to specify custom symbol shapes. To properly obey the position and size, custom symbols should be centered at (0,0) and width and height of 1.0. Note that it is also possible to ‘install’ custom shapes by setting ScatterPlotItem.Symbols[key] = shape.
pen The pen (or list of pens) to use for drawing spot outlines.
brush The brush (or list of brushes) to use for filling spots.
size The size (or list of sizes) of spots. If pxMode is True, this value is in pixels. Otherwise, it is in the item’s local coordinate system.
data a list of python objects used to uniquely identify each spot.
identical Deprecated. This functionality is handled automatically now.
antialias Whether to draw symbols with antialiasing. Note that if pxMode is True, symbols are always rendered with antialiasing (since the rendered symbols can be cached, this incurs very little performance cost)
name The name of this item. Names are used for automatically generating LegendItem entries and by some exporters.
setPen(*args, **kargs)[source]

Set the pen(s) used to draw the outline around each spot. If a list or array is provided, then the pen for each spot will be set separately. Otherwise, the arguments are passed to pg.mkPen and used as the default pen for all spots which do not have a pen explicitly set.

setSize(size, update=True, dataSet=None, mask=None)[source]

Set the size(s) used to draw each spot. If a list or array is provided, then the size for each spot will be set separately. Otherwise, the argument will be used as the default size for all spots which do not have a size explicitly set.

setSymbol(symbol, update=True, dataSet=None, mask=None)[source]

Set the symbol(s) used to draw each spot. If a list or array is provided, then the symbol for each spot will be set separately. Otherwise, the argument will be used as the default symbol for all spots which do not have a symbol explicitly set.