Skip to content

Fix: Axis and grid panes out of sync when inverting an axis - #31992

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
HakonSohoel:fix-inverted-3d-axis-placement
Jul 9, 2026
Merged

Fix: Axis and grid panes out of sync when inverting an axis#31992
QuLogic merged 1 commit into
matplotlib:mainfrom
HakonSohoel:fix-inverted-3d-axis-placement

Conversation

@HakonSohoel

@HakonSohoel HakonSohoel commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

closes #31989

PR summary

When inverting an axis of a 3d plot the axis and background pane got out of sync.
This is a regression from previous versions.

This PR fixes the bug and adds a regression test for it.

Example

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.invert_zaxis()

plt.show()

Resulting plot with the bug:
image

Resulting plot after this fix:
image

AI Disclosure

AI was used as a sparring partner to get acquainted with the repository and pinpointing the possible location of the bug.

PR checklist

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@rcomer rcomer added this to the v3.11.1 milestone Jul 4, 2026

@scottshambaugh scottshambaugh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a nice clean fix to me, thanks @HakonSohoel!

Comment thread lib/mpl_toolkits/mplot3d/axis3d.py
@HakonSohoel
HakonSohoel force-pushed the fix-inverted-3d-axis-placement branch 2 times, most recently from 791edac to 904dc8f Compare July 7, 2026 08:58
Comment thread lib/mpl_toolkits/mplot3d/axis3d.py
@QuLogic
QuLogic force-pushed the fix-inverted-3d-axis-placement branch from 904dc8f to 0797150 Compare July 9, 2026 17:59
@QuLogic
QuLogic force-pushed the fix-inverted-3d-axis-placement branch from 0797150 to d618766 Compare July 9, 2026 18:04
@QuLogic
QuLogic merged commit 3281435 into matplotlib:main Jul 9, 2026
39 of 41 checks passed
QuLogic added a commit that referenced this pull request Jul 10, 2026
QuLogic added a commit that referenced this pull request Jul 10, 2026
…992-on-v3.11.x

Backport PR #31992 on branch v3.11.x (Fix: Axis and grid panes out of sync when inverting an axis)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Axis and grid panes out of sync, regression in 3.11

4 participants