Skip to content

silx.gui.plot.PlotWidget: Fixed keep aspect ratio with matplotlib tight layout - #4734

Merged
t20100 merged 2 commits into
mainfrom
fix-drag-keep-aspect-ratio-tight-layout
Oct 2, 2026
Merged

t20100 merged 2 commits into
mainfrom
fix-drag-keep-aspect-ratio-tight-layout

Conversation

@t20100

@t20100 t20100 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

PR summary

This PR fixes a regression introduced in silx 3.1.x (see #4723).
Keeping issue #4723 opened since an issue remains with aspect ratio and tight layout which was already there in silx v.3.0

AI Disclosure

  • No AI used

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()

@t20100
t20100 force-pushed the fix-drag-keep-aspect-ratio-tight-layout branch from 947de87 to 4d6272e Compare October 2, 2026 09:25

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

@t20100
t20100 marked this pull request as ready for review October 2, 2026 09:29
@t20100
t20100 requested a review from loichuder October 2, 2026 09:29

@loichuder loichuder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💪

@t20100
t20100 merged commit c6e9bcc into main Oct 2, 2026
4 checks passed
@t20100
t20100 deleted the fix-drag-keep-aspect-ratio-tight-layout branch October 2, 2026 10:04
@t20100 t20100 mentioned this pull request Oct 2, 2026
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants