Repository navigation
Prevents axes limits from being resized by axes.fill_between - #25712
Conversation
There was a problem hiding this comment.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
|
This could probably use a test of this behavior, something like the code from #25682 I don't think it needs to be an image comparison test, just an assertion that the limits are the same before/after the |
| if "transform" not in kwargs: | ||
| self.update_datalim(pts, updatex=True, updatey=True) |
There was a problem hiding this comment.
This should probably check the transform branches, similar to how lines do:
matplotlib/lib/matplotlib/axes/_base.py
Line 2354 in 690884f
There was a problem hiding this comment.
That may be a bit more complete, yeah... for reference I based the original suggestion on axline:
matplotlib/lib/matplotlib/axes/_axes.py
Lines 910 to 913 in b86ebba
There was a problem hiding this comment.
@QuLogic I'm not yet very well-versed with transforms - wondering if you could provide some guidance as to how this would work?
I will continue to look into this as well.
There was a problem hiding this comment.
See #25324 for a similar application of the transform branches for update_datalim on vlines/hlines. (Though I don't know for sure that you also need to handle rectilinear specifically as is done in that PR; just the transform bit might be enough.)
|
@ksunden I did a few basic image tests after initially making the changes: Additionally, I also tested with an assertion (per your recommendation) which verified that the axes limits remain the same before and after the |
|
@olinjohnson could you make this a unit test in lib/matplotlib/tests/test_axes.py? https://matplotlib.org/stable/devel/testing.html#writing-a-simple-test This will help us to ensure that the expected behavior is retained through future changes. |
|
Yes! I added the unit test - sorry, should have done this before. |
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
Thank you for your contribution, hope to hear from you again! |
Pin 690884facc1e80b40640649f2a64ceab67afb42e and its regression selectors for reproducible runs. Source: matplotlib/matplotlib#25712


PR Summary
Closes #25682 by preventing
Axes.fill_between()from automatically adjusting the axes limits when using axes coordinates. When axes coordinates are not in use and thus no transformation is passed toAxes.fill_between(), then adjusting the axes limits is necessary, but previously, in some cases, a transformation might have been in use and using axes coordinates could have caused the axes limits to be resized improperly.PR Checklist
Documentation and Tests
pytestpasses)Release Notes
.. versionadded::directive in the docstring and documented indoc/users/next_whats_new/.. versionchanged::directive in the docstring and documented indoc/api/next_api_changes/next_whats_new/README.rstornext_api_changes/README.rst