Plot interaction

A description.

class cued_datalogger.api.pyqtgraph_extensions.InteractivePlotWidget(parent=None, show_region=True, show_crosshair=True, show_label=True, *args, **kwargs)

Bases: PyQt5.QtWidgets.QWidget

A QWidget containing a CustomPlotWidget with mouse tracking crosshairs, a LinearRegionItem, and spinboxes to display and control the values of the bounds of the linear region. Any additional arguments to :method:`__init__` are passed to the CustomPlotWidget.

Attributes

PlotWidget (pg.PlotWidget) The PlotWidget contained in the InteractivePlotWidget.
ViewBox (pg.ViewBox) The ViewBox contained in the InteractivePlotWidget.
region (pg.LinearRegionItem) The LinearRegionItem contained in the InteractivePlotWidget.
vline (pg.InfiniteLine) Vertical mouse-tracking line.
hline (pg.InfiniteLine) Horizontal mouse-tracking line.
label (pg.LabelItem) LabelItem displaying current mouse position.
lower_box (QSpinBox) QSpinBox displaying lower bound of region.
upper_box (QSpinBox) QSpinBox displaying upper bound of region.
zoom_btn (QPushButton) Press to zoom to the region with a set amount of padding.
show_region (bool) Controls whether the region is displayed.
show_crosshair (bool) Controls whether the crosshair is displayed.
sig_region_changed (pyqtSignal([int, int])) The signal emitted when the region is changed.

Methods

clear()

Clear the PlotWidget and add the default items back in.

getRegionBounds()

Return the lower and upper bounds of the region.

plot(x=None, y=None, *args, **kwargs)

update_limits() from the x and y values, then plot the data on the plotWidget.

update_limits(x, y)

Set the increment of the spinboxes, the limits of zooming and scrolling the PlotItem, and move the region to x=0

zoomToRegion(padding=0.1)

Zoom to the region, with given padding.

class cued_datalogger.api.pyqtgraph_extensions.CustomPlotWidget(*args, show_region=True, show_crosshair=True, show_label=True, **kwargs)

Bases: pyqtgraph.widgets.PlotWidget.PlotWidget

Attributes

lastFileDir  

Methods

autoRange_override(padding=None, items=None)

Autorange the view to fit the plotted data, ignoring the location of the crosshair. Accessed as autoRange(), not as autoRange_override().

clear_override(*args, **kwargs)

Clear the PlotItem and add the default items back in. Accessed as clear(), not as clear_override().

mouseMoved(mouse_moved_event)

Update the crosshair and label to match the mouse position.

plot_override(*args, **kwargs)

Plot data on the widget and autoRange. Accessed as plot(), not as plot_override().

set_show_crosshair(show_crosshair)

Set whether the crosshair is visible.

set_show_label(show_label)

Set whether the label is visible.

set_show_region(show_region)

Set whether the region is visible.