Fix 3D axes to properly support non-linear scales (log, symlog, etc.) #30980
+380
−93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR summary
This fixes a long-standing issue where 3D plots ignored scale transforms. The methods set_xscale(), set_yscale(), set_zscale() existed but the transforms were never applied to data or coordinates.
Closes #209 - a 15 year old bug and matplotlib's oldest open issue!
This is currently a work in progress - the core functionality works but I need to clean up the implementation, add tests, add docs, and add example gallery usage.
Example usage:
Notes on generative AI usage
This issue has been sitting in my to-solve backlog for a few years, and on a whim I decided to have Claude Code take a crack at it. I'm blown away by the results - the first commit in this PR which substantially solved the issue was completely written by Opus 4.5 over the course of only about 1 hour with minimal prompting. I left Claude authorship on the commit, which I believe is a first for the repo.
My own domain expertise in the 3D section of the codebase definitely helped frame the question and set the direction, but I had basically no experience with the scale transform logic or where all the transform gaps in the 3D code might be. I had already spent a day on this back in 2023, and I expect this would have taken me several more days to learn the right sections of the codebase and implement on my own.
The workflow I used, as a case study:
Details
Initial claude code prompt in plan mode:CC's plan:
I accepted the plan without edits, and CC started working in agent mode. After each iteration I would check the output figure, and send essentially the same message:
After the 4th or 5th iteration things looked like they were working as expected, and that result is what's in the first commit: b73427f
PR checklist