PyDMEventPlot

class pydm.widgets.eventplot.PyDMEventPlot(parent=None, channel=None, init_x_indices=[], init_y_indices=[], background='default')[source]

Bases: BasePlot

PyDMEventPlot is a widget to plot one scalar value against another. All of the values arrive in a single event-built array, and indices are used to identify which values to plot. Multiple scalar pairs can be plotted on the same plot. Each pair has a buffer which stores previous values. All values in the buffer are drawn. The buffer size for each pair is user configurable.

Parameters:
  • parent (optional) – The parent of this widget.

  • channel (optional) – A string with the address for a channel. This channel should produce an array of data for each event. The index parameters are used to select data from this array to be plotted.

  • init_x_indices (optional) – init_x_indices can be None, an integer, or a list of integers possibly containing None. These indices are used to select values from the data array provided by channel to be plotted. In the event that an index is None, the curve will be created, but no plotting will occur until an integer index is set. If lists are specified for both init_x_indices and init_y_indices, they both must have the same length. If a single x index was specified, and a list of y indices is specified, all of the selected y data will be plotted against the same x.

  • init_y_indices (optional) – init_y_indices can be None, an integer, or a list of integers possibly containing None. These indices are used to select values from the data array provided by channel to be plotted. In the event that an index is None, the curve will be created, but no plotting will occur until an integer index is set. If lists are specified for both init_x_indices and init_y_indices, they both must have the same length. If a single x index was specified, and a list of y indices is specified, all of the selected y data will be plotted against the same x.

  • background (optional) – The background color for the plot. Accepts any arguments that pyqtgraph.mkColor will accept.

addChannel(channel=None, y_idx=None, x_idx=None, name=None, color=None, lineStyle=None, lineWidth=None, symbol='o', symbolSize=5, buffer_size=None, yAxisName=None, bufferSizeChannelAddress=None)[source]

Add a new curve to the plot. In addition to the arguments below, all other keyword arguments are passed to the underlying pyqtgraph.PlotDataItem used to draw the curve.

Parameters:
  • channel (str) – The channel for the curve data.

  • y_idx (int) – The index for the y data for the curve.

  • x_idx (int, optional) – The index for the x data for the curve.

  • name (str, optional) – A name for this curve. The name will be used in the plot legend.

  • color (str or QColor, optional) – A color for the line of the curve. If not specified, the plot will automatically assign a unique color from a set of default colors.

  • lineStyle (int, optional) – Style of the line connecting the data points. 0 means no line (scatter plot).

  • lineWidth (int, optional) – Width of the line connecting the data points.

  • buffer_size (int, optional) – number of points to keep in the buffer.

  • bufferSizeChannelAddress (str, optional) – The name of a channel that defines the buffer size (int).

  • symbol (int, optional) – Which symbol to use to represent the data.

  • symbol – Size of the symbol.

  • yAxisName (str, optional) – The name of the y axis to associate with this curve. Will be created if it doesn’t yet exist

autoRangeX

Whether or not the X-axis automatically rescales to fit the data. If true, the values in minXRange and maxXRange are ignored.

autoRangeY

Whether or not the Y-axis automatically rescales to fit the data. If true, the values in minYRange and maxYRange are ignored.

channels()[source]

Returns the list of channels used by all curves in the plot.

Return type:

list

clearCurves()[source]

Remove all curves from the plot.

curves

Get a list of json representations for each curve.

getCurves()[source]

Get a list of json representations for each curve.

maxXRange

Maximum X-axis value visible on the plot.

maxYRange

Maximum Y-axis value visible on the plot.

minXRange

Minimum X-axis value visible on the plot.

minYRange

Minimum Y-axis value visible on the plot.

redrawPlot()[source]

Request a redraw from each curve in the plot. Called by curves when they get new data.

removeChannel(curve)[source]

Remove a curve from the plot.

Parameters:

curve (EventPlotCurveItem) – The curve to remove.

removeChannelAtIndex(index)[source]

Remove a curve from the plot, given an index for a curve.

Parameters:

index (int) – Index for the curve to remove.

setCurves(new_list)[source]

Replace all existing curves with new ones. This function is mostly used as a way to load curves from a .ui file, and almost all users will want to add curves through addChannel, not this method.

Parameters:

new_list (list) – A list of json strings representing each curve in the plot.