-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: inset_locator is broken when used with subfigures #24589
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
That seems likely as |
From a quick try, the fix seems to be simply diff --git i/lib/mpl_toolkits/axes_grid1/inset_locator.py w/lib/mpl_toolkits/axes_grid1/inset_locator.py
index bb90f8273c..0771efd71f 100644
--- i/lib/mpl_toolkits/axes_grid1/inset_locator.py
+++ w/lib/mpl_toolkits/axes_grid1/inset_locator.py
@@ -73,7 +73,7 @@ class AnchoredLocatorBase(AnchoredOffsetbox):
bbox = self.get_window_extent(renderer)
px, py = self.get_offset(bbox.width, bbox.height, 0, 0, renderer)
bbox_canvas = Bbox.from_bounds(px, py, bbox.width, bbox.height)
- tr = ax.figure.transFigure.inverted()
+ tr = ax.figure.transSubfigure.inverted()
return TransformedBbox(bbox_canvas, tr) |
Labeling this as easy and good first issue because there is a proposed patch and a clear reproduction case. The tasks here:
|
mind if I grab this one? Long time user. Would love to be a first time contributor |
ax.inset_axes works great btw
…On Fri, Dec 2, 2022 at 8:09 PM Jody Klymak ***@***.***> wrote:
That seems likely as axes_grid1 is not very subfigure-aware. Did you try
with ax.inset_axes instead?
—
Reply to this email directly, view it on GitHub
<#24589 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI5WOUEPP2N4LBAAHLEOGTWLKMVHANCNFSM6AAAAAASSMYI5E>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Please go ahead @matt256 ! We do not assign issues though. |
Understood. Thank you and will do. Fix confirmed. Working on the test |
PR submitted, but i had some issues with the styling of the test image through the decorator not being classic so i just made the comparison image in the classic style. Naturally i figured out i had to change it to mpl20 as soon as I submitted the PR. I assume i can push another commit to a PR? |
Sure @matt256, you can update your PR as needed. If you need help feel free to ping 😄 |
@amcpherson Hello sir,i want to work on this issue,please assign this to me |
Bug summary
When using inset_locator functions in subfigures, the plots are not placed correctly. Adapting this demo
https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.html
to use subfigures shows incorrect plots.
Code for reproduction
Actual outcome
Expected outcome
Something more similar to https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.html
Additional information
No response
Operating system
OS/X
Matplotlib Version
3.6.1
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
No response
Jupyter version
No response
Installation
pip
The text was updated successfully, but these errors were encountered: