-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
zooming problem on figures with shared axes #2790
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 is a fun bug and can confirm it on master. This so probably something subtle deep in the callback code so I am tagging this as 1.4.x (instead of 1.4.0). |
Perhaps there is a subtle assumption that shared axes must be on the same |
This does not involve closing windows, just resizing them. |
Except for the part where it does: "Interestingly if I close the figures my |
Fair enough, but that is well after the bug has been triggered, I would classify that as a symptom rather than a cause. After re-sizing zooming also does not work correctly. |
This can be solved the same way as #1325 The following works as expected: import matplotlib.pyplot as plt
fig0 = plt.figure()
a0 = fig0.add_subplot(121)
a0.set_adjustable('box-forced')
a0.imshow(p.rand(100, 100))
a1 = fig0.add_subplot(122, sharex=a0, sharey=a0)
a1.set_adjustable('box-forced')
a1.imshow(p.rand(100, 100)**2)
fig1 = plt.figure()
a2 = fig1.add_subplot(121, sharex=a0, sharey=a0)
a2.set_adjustable('box-forced')
a2.imshow(p.rand(100, 100)**3) The key is the |
@tacaswell, your example above (just the first figure part) works only when the image domains are identical; for example, if you clear the second axes and then call imshow with np.random.rand(20,20), the first image will show only its 20x20 subarray. |
@efiring: Should we reopen this, then? |
My suspicion is that this is, as @WeatherGod suggested, a problem with sharing axes across figures. I don't think this was ever intended to be supported, and I don't think it makes sense. Therefore the fix would be to add a check to the sharex kwarg handling to ensure the two axes are in the same figure. |
Sharex and sharey are only supported for sharing within a single figure. Closes matplotlib#2790.
Even though we now have an example of sharing in different figures, the bug remains as originally described in this issue, complete with 100% CPU after closing the windows. Regardless of how the endless loop is arising, the underlying problem is a fundamental conflict between locking together the x and y limits and the aspect ratio between axes in two figures when the figure aspect ratio is not identical. This is just one of the examples of where aspect ratio handling and sharing runs into the problem of over-specification, which is the reason I never liked the box_forced option--it only works under restrictive conditions. |
Sharex and sharey are only supported for sharing within a single figure. Closes matplotlib#2790.
I don't see that this is a problem anymore on master. I'm guessing recent work has fixed this... |
Hi!
I am trying to use axes shared across different figures and run into a funny effect when I resize one of the windows.
If I do:
zooming into one of the axes does as expected: the other two follow.
However, when I resize one of the windows, all three axes zoom out completely (and not in one jump, it looks like seeing the image would be slowly falling away...)
Interestingly if I close the figures my shell still keeps on doing stuff backstage: my cpu is 100% busy. I tried this both under Ipython and a normal python shell.
Under Ipython a ctrl-C leads to the following traceback.
thanks in advance!
JF
The text was updated successfully, but these errors were encountered: