Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions LDAQ/visualization/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
QPushButton, QHBoxLayout, QDesktopWidget, QProgressBar, QLabel,
QSizePolicy)
from PyQt5.QtCore import QTimer, Qt, QPointF
from PyQt5.QtGui import QColor, QPainter, QBrush, QPen, QIcon, QFont
from PyQt5.QtGui import QColor, QPainter, QBrush, QPen, QIcon, QFont, QFontMetrics
haspyqt = True
except ImportError:
ImageView = object
Expand Down Expand Up @@ -129,7 +129,7 @@ def __init__(self, refresh_rate: int = 100, max_points_to_refresh: int = 10000,
max_points_to_refresh (int, optional): The maximum number of points to refresh in the plot. Adjust this number to optimize performance.
This number is used to compute the `nth` value automatically. Defaults to 10000.
sequential_plot_updates (bool, optional): If `True`, the plot is updated sequentially (one line at a time).
If `False`, all lines are updated in each iteration of the main loop. Defaults to `True`.
If `False`, all lines are updated in each iteration of the main loop. Defaults to `False`.

"""
if not haspyqt:
Expand Down Expand Up @@ -656,7 +656,8 @@ def init_plots(self):

self.time_start = time.time()
grid_layout = pg.GraphicsLayoutWidget()

grid_layout.viewport().setContentsMargins(100, 0, 0, 0)

self.subplots = {}
self.legends = {}

Expand Down Expand Up @@ -762,6 +763,22 @@ def init_plots(self):
legend.addItem(item, item.opts['name'])
self.legends[pos] = legend

# Lock the axis sizes to ensure equal sizing of all subplots
for plot in self.subplots.values():
ax = plot.getAxis('left')
ax.setWidth(ax.boundingRect().width())

ax = plot.getAxis('bottom')
ax.setHeight(ax.boundingRect().height())

fm = QFontMetrics(plot.getAxis('left').label.font())
plot.getAxis('left').setWidth(fm.horizontalAdvance('0') * 6 + fm.height())






self.plots = self.vis.plots


Expand Down