PyDMWaveformPlot¶
-
class
pydm.widgets.waveformplot.
PyDMWaveformPlot
(parent=None, init_x_channels=[], init_y_channels=[], background='default')[source]¶ PyDMWaveformPlot is a widget to plot one or more waveforms.
Each curve can plot either a Y-axis waveform vs. its indices, or a Y-axis waveform against an X-axis waveform.
- Parameters
parent (optional) – The parent of this widget.
init_x_channels (optional) – init_x_channels can be a string with the address for a channel, or a list of strings, each containing an address for a channel. If not specified, y-axis waveforms will be plotted against their indices. If a list is specified for both init_x_channels and init_y_channels, they both must have the same length. If a single x channel was specified, and a list of y channels are specified, all y channels will be plotted against the same x channel.
init_y_channels (optional) – init_y_channels can be a string with the address for a channel, or a list of strings, each containing an address for a channel. If a list is specified for both init_x_channels and init_y_channels, they both must have the same length. If a single x channel was specified, and a list of y channels are specified, all y channels will be plotted against the same x channel.
background (optional) – The background color for the plot. Accepts any arguments that pyqtgraph.mkColor will accept.
-
addChannel
(y_channel=None, x_channel=None, name=None, color=None, lineStyle=None, lineWidth=None, symbol=None, symbolSize=None, redraw_mode=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
y_channel (str) – The address for the y channel for the curve.
x_channel (str, optional) – The address for the x channel 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.
redraw_mode (int, optional) –
- WaveformCurveItem.REDRAW_ON_EITHER: (Default)
Redraw after either X or Y receives new data.
- WaveformCurveItem.REDRAW_ON_X:
Redraw after X receives new data.
- WaveformCurveItem.REDRAW_ON_Y:
Redraw after Y receives new data.
- WaveformCurveItem.REDRAW_ON_BOTH:
Redraw after both X and Y receive new data.
symbol (int, optional) – Which symbol to use to represent the data.
symbol – Size of the symbol.
-
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.
- Returns
- Return type
list
-
curves
¶ 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 (WaveformCurveItem) – 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.