Skip to content
Merged
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
10 changes: 5 additions & 5 deletions src/silx/gui/plot/backends/BackendMatplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,

@t20100 t20100 Oct 2, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API modernisation: supported by matplotlib >=3.6

)
self.fig.set_facecolor("w")

Expand Down Expand Up @@ -1247,13 +1247,13 @@ def _setPlotBounds(
if not self.isKeepDataAspectRatio():
newXRange, newYRange, newY2Range = xRange, yRange, y2Range
else:
bbox = self.fig.get_window_extent()

@t20100 t20100 Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the issue introduced in PR #4628 commit d48b1e0: getPlotBoundsInPixels should be used here instead of 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,
Expand Down
Loading