-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Wrong coordinate transform on jupyter notebook (inline backend) #4865
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
maybe related to #4375 ? |
I think this is definitely related even though I wasn't able to have it working in any way |
The documentation does warn in the note that it might not work correctly in the interactive cases. The reason is that the transformation from data space -> screen space depends on the dpi and figure size. In this case the pixel location of the point is being computed. IPython turns the dpi on the figures produced by inline way down, hence why you get the shift. I think the behavior you are seeing is the correct and expected behavior. You should do your best to avoid working in screen units. |
What I'm trying to do is connect points between two inset axes (similarly to #4375). I was wondering, if I run savefig (from terminal), isn't that supposed to work properly? I still get a different offset. I think that's likely because png renderer does as well scale the picture, but how do we know what dpi setting I should set so that the pre-render screen coordinate and post-render screen coordinates match? |
The problem is still that you are computing the pixel to point to with one set of transforms and rendering the final figure (most likely either the figure size or dpi changed). Unless you are super careful and/or re-compute the pixel location on every draw stay I strongly advise against using absolute pixels for anything. As with #4375 the transforms on inset axes may not be initialized until after the first draw. Attach the annotation to the inset axes with the highest zorder. It would be helpful if you posted a minimal example demonstrating your problem. |
Hi, I've been trying to the example http://matplotlib.org/pyplots/annotate_transform.py in jupyter notebook (inline backend) as described in the transformation tutorial http://matplotlib.org/users/transforms_tutorial.html
However the picture I obtain is somehow shifted from the expected output:

Is this something you can reproduce? How can I fix that?
I'm using the matplotlib version just pulled from git
The text was updated successfully, but these errors were encountered: