You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: add_patch incorrectly decides whether to autoscale axes for non-separable transforms #26796
Axes.add_patch(patch) is intended to update the axes limits based on the patch limits only if that can help making the patch fit within the view; in other words, if the patch uses e.g. Axes.get_xaxis_transform() (i.e. is an axvspan), then autoscaling the y (data) limits doesn't do anything to help making the patch fit within the view as the patch's y coordinates are in axes relative units.
However, this patch is incorrectly implemented for non-separable axes.
On the rectilinear axes, add_patch correctly understands that the rectangle uses relative y limits (0, 0.25) and therefore keeps the default y limits (-0.05, 0.05)).
On the polar axes, it doesn't (even though the patch indeed goes to 0.25 the max radius), and thus tries to autoscale the radial axis to (0, 0.25) (+ margin).
Expected outcome
No autoscaling of the y limits on the second plot.
Additional information
I suspect this comes down to understanding/writing down what would be the really useful semantics for contains_branch_separately (upon which add_patch relies) in that case.
(Noted while working on #26788, where I just manually undo the "wrong" axes limits update.)
I suspect that a proper generic solution for #15518 (which was fixed by special-casing in #25324) would require something similar too.
Activity