diff --git a/src/silx/gui/plot/backends/BackendMatplotlib.py b/src/silx/gui/plot/backends/BackendMatplotlib.py index 7433eda591..26adcef7a0 100755 --- a/src/silx/gui/plot/backends/BackendMatplotlib.py +++ b/src/silx/gui/plot/backends/BackendMatplotlib.py @@ -522,7 +522,7 @@ def __init__(self, plot, parent=None): self._axesDisplayed = True self.fig = Figure( - tight_layout=config._MPL_TIGHT_LAYOUT, + layout="tight" if config._MPL_TIGHT_LAYOUT else None, ) self.fig.set_facecolor("w") @@ -1247,13 +1247,13 @@ def _setPlotBounds( if not self.isKeepDataAspectRatio(): newXRange, newYRange, newY2Range = xRange, yRange, y2Range else: - bbox = self.fig.get_window_extent() + plotWidth, plotHeight = self.getPlotBoundsInPixels()[2:] if keepDim is None: xDataRange, yDataRange, _ = self._plot.getDataRange() - keepDim = findDimToKeep(bbox.width, bbox.height, xDataRange, yDataRange) + keepDim = findDimToKeep(plotWidth, plotHeight, xDataRange, yDataRange) newXRange, newYRange, newY2Range = ensureAspectRatio( - bbox.width, - bbox.height, + plotWidth, + plotHeight, xRange, yRange, y2Range,