-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: bad autolimit behavior with fill_between and transforms #21976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
Ah right - I remember seeing this in the docs, and it may have been the initial motivation for my question about bypassing specific artists in limit calculations. |
Re: bypassing specific artists, see #15595. For the specific issue here, it looks like the "natural" diff --git i/lib/matplotlib/axes/_axes.py w/lib/matplotlib/axes/_axes.py
index b8a7c3b2c6..fdc35d9335 100644
--- i/lib/matplotlib/axes/_axes.py
+++ w/lib/matplotlib/axes/_axes.py
@@ -5242,14 +5242,7 @@ default: :rc:`scatter.edgecolors`
polys.append(pts)
collection = mcoll.PolyCollection(polys, **kwargs)
-
- # now update the datalim and autoscale
- pts = np.row_stack([np.column_stack([ind[where], dep1[where]]),
- np.column_stack([ind[where], dep2[where]])])
- if ind_dir == "y":
- pts = pts[:, ::-1]
- self.update_datalim(pts, updatex=True, updatey=True)
- self.add_collection(collection, autolim=False)
+ self.add_collection(collection)
self._request_autoscale_view()
return collection fixes it. It's probably worth going through all |
Uh oh!
There was an error while loading. Please reload this page.
Bug summary
Using a fill_between artist with a custom transform to displace data along the y-axis, the autolimiting behavior does not work as I would expect: the axes use the non-transformed data extents. A normal line plot with the same transform does work as I would expect: autolimits match the transformed data.
Code for reproduction
Actual outcome
Expected outcome
If I force the ylimits on the second plot via
it looks like

which is basically how I would expect.
Additional information
I'm not sure that the plot behavior is actually to spec here, but the disagreement between the two artists' behavior seems to me like a bug somewhere.
Operating system
Ubuntu
Matplotlib Version
3.5.0
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
sys.version_info(major=3, minor=9, micro=7, releaselevel='final', serial=0)
Jupyter version
3.2.5 (dev), 3.2.4 (app)
Installation
conda
The text was updated successfully, but these errors were encountered: