From 0aa084f99aca78c680bc9835cd1255b9be58e36d Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Fri, 19 Jun 2026 15:44:51 +0200 Subject: [PATCH 1/3] rename chooseAxis->axisScales and move buttons in toolbar --- src/silx/gui/plot/PlotWindow.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/silx/gui/plot/PlotWindow.py b/src/silx/gui/plot/PlotWindow.py index d596af2c97..3e38183b27 100644 --- a/src/silx/gui/plot/PlotWindow.py +++ b/src/silx/gui/plot/PlotWindow.py @@ -109,7 +109,6 @@ def __init__( resetzoom=True, autoScale=True, logScale=True, - chooseScale=False, grid=True, curveStyle=True, colormap=True, @@ -123,6 +122,7 @@ def __init__( roi=True, mask=True, fit=False, + axisScales=False, ): super().__init__(parent=parent, backend=backend) if parent is None: @@ -186,14 +186,14 @@ def __init__( self.yAxisLogarithmicAction.setVisible(logScale) self.addAction(self.yAxisLogarithmicAction) - self.xAxisScaleButton = PlotToolButtons.XAxisScaleToolButton( + self._xAxisScaleButton = PlotToolButtons.XAxisScaleToolButton( parent=self, plot=self ) - self.xAxisScaleButton.setVisible(chooseScale) - self.yAxisScaleButton = PlotToolButtons.YAxisScaleToolButton( + self._xAxisScaleButton.setVisible(axisScales) + self._yAxisScaleButton = PlotToolButtons.YAxisScaleToolButton( parent=self, plot=self ) - self.yAxisScaleButton.setVisible(chooseScale) + self._yAxisScaleButton.setVisible(axisScales) self.gridAction = self.group.addAction( actions.control.GridAction(self, gridMode="both", parent=self) @@ -487,12 +487,8 @@ def _createToolBar(self, title, parent): self.yAxisInvertedAction = toolbar.insertWidget( self.colorbarAction, self.yAxisInvertedButton ) - self.xAxisScaleAction = toolbar.insertWidget( - self.colorbarAction, self.xAxisScaleButton - ) - self.yAxisScaleAction = toolbar.insertWidget( - self.colorbarAction, self.yAxisScaleButton - ) + toolbar.insertWidget(self.gridAction, self._xAxisScaleButton) + toolbar.insertWidget(self.gridAction, self._yAxisScaleButton) return toolbar def saveGraph( @@ -782,6 +778,12 @@ def getYAxisLogarithmicAction(self): """ return self.yAxisLogarithmicAction + def getXAxisScaleButton(self) -> PlotToolButtons.XAxisScaleToolButton: + return self._xAxisScaleButton + + def getYAxisScaleButton(self) -> PlotToolButtons.YAxisScaleToolButton: + return self._yAxisScaleButton + def getGridAction(self): """Action to toggle the grid visibility in the plot @@ -923,7 +925,7 @@ def __init__(self, parent=None, backend=None): resetzoom=True, autoScale=True, logScale=False, - chooseScale=True, + axisScales=True, grid=True, curveStyle=True, colormap=False, @@ -975,7 +977,7 @@ def __init__(self, parent=None, backend=None): resetzoom=True, autoScale=False, logScale=False, - chooseScale=False, + axisScales=False, grid=False, curveStyle=False, colormap=True, From 0bd75ecff0dfbf2b675018da88266956a537893e Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Fri, 19 Jun 2026 15:45:48 +0200 Subject: [PATCH 2/3] Remove unused _sigLogarithmicChanged --- src/silx/gui/plot/items/axis.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/silx/gui/plot/items/axis.py b/src/silx/gui/plot/items/axis.py index 844ea1f5e5..647ff6d613 100644 --- a/src/silx/gui/plot/items/axis.py +++ b/src/silx/gui/plot/items/axis.py @@ -78,9 +78,6 @@ class Axis(qt.QObject): sigScaleChanged = qt.Signal(str) """Signal emitted when axis scale has changed""" - _sigLogarithmicChanged = qt.Signal(bool) - """Signal emitted when axis scale has changed to or from logarithmic""" - sigAutoScaleChanged = qt.Signal(bool) """Signal emitted when axis autoscale has changed""" @@ -231,13 +228,10 @@ def setScale(self, scale: AxisScaleType): return # For the backward compatibility signal - emitLog = self._scale == self.LOGARITHMIC or scale == self.LOGARITHMIC self._scale = scale self._internalSetScale() self.sigScaleChanged.emit(self._scale) - if emitLog: - self._sigLogarithmicChanged.emit(self._scale == self.LOGARITHMIC) def _isLogarithmic(self) -> bool: """Return True if this axis scale is logarithmic, False if linear.""" @@ -539,7 +533,6 @@ def __init__(self, plot, mainAxis): self.__mainAxis = mainAxis self.__mainAxis.sigInvertedChanged.connect(self.sigInvertedChanged.emit) self.__mainAxis.sigScaleChanged.connect(self.sigScaleChanged.emit) - self.__mainAxis._sigLogarithmicChanged.connect(self._sigLogarithmicChanged.emit) self.__mainAxis.sigAutoScaleChanged.connect(self.sigAutoScaleChanged.emit) def _internalSetCurrentLabel(self, label): From f5c510b059fc2da6bea977fb54aa21c03ee9dd91 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Fri, 19 Jun 2026 15:46:12 +0200 Subject: [PATCH 3/3] ensure replot after axis scale change --- src/silx/gui/plot/items/axis.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/silx/gui/plot/items/axis.py b/src/silx/gui/plot/items/axis.py index 647ff6d613..0e97e49f05 100644 --- a/src/silx/gui/plot/items/axis.py +++ b/src/silx/gui/plot/items/axis.py @@ -399,6 +399,7 @@ def _internalSetScale(self): for item in plot.getItems(): item._updated() plot._invalidateDataRange() + plot._setDirtyPlot() if scale == self.LOGARITHMIC: self._getBackend().setXAxisScale(scale="log") @@ -464,6 +465,8 @@ def _internalSetScale(self): for item in plot.getItems(): item._updated() plot._invalidateDataRange() + plot._setDirtyPlot() + if scale == self.LOGARITHMIC: self._getBackend().setYAxisScale(scale="log") if vmin <= 0: