From 154512d6bab0721c0deb98f0468023353b6104cf Mon Sep 17 00:00:00 2001 From: Marko Zupan <35140214+ZupanMarko@users.noreply.github.com> Date: Wed, 24 Dec 2025 08:57:49 +0100 Subject: [PATCH] Issue #47 hotfix --- LDAQ/visualization/visualization.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/LDAQ/visualization/visualization.py b/LDAQ/visualization/visualization.py index 8d48fcc..228dad3 100644 --- a/LDAQ/visualization/visualization.py +++ b/LDAQ/visualization/visualization.py @@ -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 @@ -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: @@ -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 = {} @@ -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