mplot3d: add set_offsets3d for 3D patch/path collections#31279
mplot3d: add set_offsets3d for 3D patch/path collections#31279xndvaz wants to merge 2 commits intomatplotlib:mainfrom
Conversation
|
This does not address all the comments I left on the prior PR. |
|
Thanks for the quick feedback. I tried to address the points from the prior PR as follows:
If I am still missing one or more of your prior points, could you please point out which specific ones are still unresolved? I am happy to revise. |
|
|
Thanks for clarifying. I updated the PR description to mark this as a partial fix (no longer claiming it closes #784). For follow-up coverage, could you point me to the specific 3D artist classes you want included in this PR? I can extend it accordingly. |
|
Could you first please clarify if you are using AI assistance to write your comments here? |
|
Yes. For comments, I use AI only for translation/grammar because I'm a Brazilian Portuguese speaker and wanna communicate clearly in English. The technical reasoning is mine: I reviewed the code changes myself, ran the tests locally and I can explain each change in detail. I also disclosed AI assistance in the PR template. :) |
|
Ok, translation is fine. We would want to bring this in for all 3D artists at the same time, so that there is consistent behavior. We would also want to include I also do not understand the purpose of the array modification tests, could you please explain why those are needed? |
|
Thanks for clarifying. Understood on consistency. I'll revise this PR to add a consistent 3D offset API across all relevant mplot3d artists, including a getter counterpart ( About the If you prefer this PR to stay strictly on offsets APIs, I can remove the |
PR summary
This PR improves
mplot3doffset updates for 3D collections.Path3DCollectionandPatch3DCollectionproject 3D offsets to 2D during draw, so updating throughset_offsets()(2D data) is lossy and does not update the 3D source offsets. This PR adds an explicitset_offsets3d(xs, ys, zs, *, zdir='z')method to both classes and routesset_3d_properties()through that path.Tests added:
set_offsets3d()updates onPath3DCollectionset_offsets3d()updates onPatch3DCollectionset_array()updates onPath3DCollectionset_array()updates onPatch3DCollectionLocal test command run:
python -m pytest -q lib/mpl_toolkits/mplot3d/tests/test_axes3d.pyPartially addresses #784.
AI Disclosure
I used AI tooling to help draft and iterate the code and tests. I manually reviewed the implementation, validated behavior locally, and ran the affected test suite before opening this PR.
PR checklist