-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Positioning floating_axes.FloatingSubplot #19832
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
Do you know what version used to behave differently? That will make it easier to track down. |
I cannot get any different result even all the way back to 2.1.2. If it did work that way, it hasn't for a very very long time. |
I also don't see anything in this code that's supposed to do a stretch in the x direction? |
The figure used to be stretched/scaled when Good Figure Generated on April 10, 2020Bad Figure Generated with Matplotlib v3.3.4 |
I mean, its pretty obvious that those are not the same figure regardless of the axes positioning issue. That makes it more than a little suspicious you have two versions of your code floating around. However, if you are sure the reproducible snippet above used to work, simply make virtual environments with old versions of matplotlib until it works. But given @QuLogic tried that back to 2.1.2, it seems unlikely that will show the problem. |
Hi, @jklymak. You are right... I guess I should have said I believe the location portion of the code is the same. Let me try to do what you said with the virtual environments, and if I can show it is reproducible, I'll report back. Thank you for your help. |
This only allocates space for the Axes; if the Axes itself has a different aspect ratio, it won't be stretched to fill the spce. |
... right, your aspect is being set by your |
Hi again, I'm able to demonstrate that my code breaks between MPL v3.2.0 and v3.3.0. I created clean conda virtual environments and installed only the minimal packages in each. The only difference between them is the matplotlib version. I then re-ran my code in both environments. Please see below. What do you think? Matplotlib v3.2.2 ResultMatplotlib v3.3.0 Result |
Great but we need a minimal example to test. I don't think your example code does this. |
Hi, @jklymak . I fixed the minimal example show it shows the problem now. The problem only appears when we include a parasite axis with Minimal working example:
Matplotlib v3.2.2 ResultMatplotlib v3.3.0 Result |
Hi, @jklymak. It looks like you are right. What do we do now? |
Make your axes a bit smaller, and don't use bbox_inches='tight'? Thats your workaround... |
Thanks, @jklymak. I can do that. I might also try setting bbox_inches manually to a static value. Out of curiosity, how long do you think it will be until the root problem gets fixed in a code release? |
This is not a well-maintained nor well-tested corner of the library. Presumably an eager user of these features would need to step up and figure out the problem! |
fwiw, this bisects to c0ab395. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
This mostly seems to have been fixed since the original report, except for the fact that bbox_inches tight appears to still leave too much room below the second axes. This part gets fixed with diff --git i/lib/mpl_toolkits/axes_grid1/parasite_axes.py w/lib/mpl_toolkits/axes_grid1/parasite_axes.py
index 2a2b5957e8..18190639d3 100644
--- i/lib/mpl_toolkits/axes_grid1/parasite_axes.py
+++ w/lib/mpl_toolkits/axes_grid1/parasite_axes.py
@@ -70,6 +70,9 @@ class ParasiteAxesBase:
# end of aux_transform support
+ def get_axes_locator(self):
+ return self._parent_axes.get_axes_locator()
+
parasite_axes_class_factory = cbook._make_class_factory(
ParasiteAxesBase, "{}Parasite") otherwise, updating the parent's axes_locator (as done in the original example) leads to the parent and the parasite's locator getting out of sync, and thus the parasite misreporting its bbox for tightbboxing purposes. This could probably use a test to avoid getting re-broken... |
Bug report
Bug summary
In a previous version of matplotlib, I was able to reposition and stretch a curvilinear coordinate axis created with floating_axes.FloatingSubplot after the axis has been created using Dividers and
ax.set_axes_locator()
. Now in matplotlib version 3.3.4 I can only get the axis to translate, but not stretch.Code for reproduction
Actual outcome
Expected outcome
I expected to be able to stretch the curvilinear coordinate system so that its x-axis is aligned with the rectangular coordinate system.
Matplotlib version
Matplotlib installed with anacond default linux installer.
The text was updated successfully, but these errors were encountered: