daplis_rtp.gui.plot_figure module
Module for plotting data in the real-time plotting tab.
Plots the data provided as number of timestamps vs. pixel number. Options for changing the plot scale (linear or logarithmic) and plotting of vertical lines at positions 64, 128, and 192 are provided. The figure widget is generated with the matplotlib navigation bar for additional control over the plot.
- class daplis_rtp.gui.plot_figure.PltCanvas(parent=None, width=7, height=4, dpi=100)[source]
Bases:
QWidget- __init__(parent=None, width=7, height=4, dpi=100)[source]
Creation of the figure widget.
The widget is created with the bar with options.
- Parameters:
width (int, optional) – Figure widget width, by default 7.
height (int, optional) – Figure widget height, by default 4.
dpi (int, optional) – Figure widget dpi, by default 100.
- setPlotData(xdataplot, yplotdata, xLim, grouping: bool = False, fontsize: int = 16)[source]
Plot data.
Plot the provided data while following the state of the axis limits and the switch for plotting vertical lines at positions 64, 128, and 192.
- Parameters:
xdataplot (array) – Data for the x-axis: pixel numbers.
yplotdata (array-like) – Data for the y-axis: number of timestamps.
xLim (list) – Limits for the x-axis.
grouping (bool, optional) – Switch for plotting vertical lines at positiong 64, 128, and 192, by default False.
- daplis_rtp.gui.plot_figure.reserve_toolbar_width(frame, canvas)[source]
Make the plot’s frame wide enough to keep the whole toolbar.
The canvas carries its own minimum width, but between it and the window sit two frames whose layouts do not pass that minimum all the way up, so the plot is squeezed and the toolbar folds its readout away regardless. An explicit minimum on the frame is respected, and is what actually reaches the window.
- daplis_rtp.gui.plot_figure.toolbar_min_width(toolbar, sample='(x, y) = (255.0, 2000.0)\n[0.957, 0.514, 0.514, 0.0857]')[source]
Width at which every toolbar button and the readout still fit.
A QToolBar squeezed below its contents hides them behind a ‘>>’ overflow button rather than forcing its parent wider - its own ‘minimumSizeHint’ is barely wider than that button - and the coordinate readout, being the widest item, is the first to go. It is also empty until the cursor reaches the axes, so nothing in the toolbar’s size hints reserves room for it while it is not needed.
The width is measured rather than assumed: the readout is asked how wide it would be with a full reading in it, which picks up the application’s font and any padding the style adds, both of which differ between machines.