PlotDataItem

class pyqtgraph.PlotDataItem(*args, **kargs)

GraphicsItem for displaying plot curves, scatter plots, or both.

__init__(*args, **kargs)

There are many different ways to create a PlotDataItem:

Data initialization: (x,y data only)

PlotDataItem(xValues, yValues) x and y values may be any sequence (including ndarray) of real numbers
PlotDataItem(yValues) y values only – x will be automatically set to range(len(y))
PlotDataItem(x=xValues, y=yValues) x and y given by keyword arguments
PlotDataItem(ndarray(Nx2)) numpy array with shape (N, 2) where x=data[:,0] and y=data[:,1]

Data initialization: (x,y data AND may include spot style)

PlotDataItem(recarray) numpy array with dtype=[(‘x’, float), (‘y’, float), ...]
PlotDataItem(list-of-dicts) [{‘x’: x, ‘y’: y, ...}, ...]
PlotDataItem(dict-of-lists) {‘x’: [...], ‘y’: [...], ...}
PlotDataItem(MetaArray) 1D array of Y values with X sepecified as axis values OR 2D array with a column ‘y’ and extra columns as needed.

Line style keyword arguments:

pen pen to use for drawing line between points. Default is solid grey, 1px width. Use None to disable line drawing.
shadowPen pen for secondary line to draw behind the primary line. disabled by default.
fillLevel fill the area between the curve and fillLevel
fillBrush fill to use when fillLevel is specified

Point style keyword arguments:

symbol symbol to use for drawing points OR list of symbols, one per point. Default is no symbol. options are o, s, t, d, +
symbolPen outline pen for drawing points OR list of pens, one per point
symbolBrush brush for filling points OR list of brushes, one per point
symbolSize diameter of symbols OR list of diameters
pxMode (bool) If True, then symbolSize is specified in pixels. If False, then symbolSize is specified in data coordinates.

Optimization keyword arguments:

identical spots are all identical. The spot image will be rendered only once and repeated for every point
decimate (int) decimate data

Meta-info keyword arguments:

name name of dataset. This would appear in a legend
setData(*args, **kargs)

Clear any data displayed by this item and display new data. See __init__() for details; it accepts the same arguments.

setPen(pen)
Sets the pen used to draw lines between points.
pen can be a QPen or any argument accepted by pyqtgraph.mkPen()
setShadowPen(pen)
Sets the shadow pen used to draw lines between points (this is for enhancing contrast or emphacizing data).
This line is drawn behind the primary pen (see setPen()) and should generally be assigned greater width than the primary pen.
pen can be a QPen or any argument accepted by pyqtgraph.mkPen()

Previous topic

Pyqtgraph’s Graphics Items

Next topic

PlotCurveItem

This Page