-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Images shifted relative to other plot feature in vector graphic output formats #1085
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
Watch what happens when you do:
the image is shrunk horizontally and centered, when it should remain fully covering the axes. I think the bug is most likely in |
That Case3 looks like your viewer is trying to keep the aspect ratio somehow. Indeed this here fixes the problem for my default SVG gnome viewer (so cairo in general?):
The bug is still shows up in Firefox and Chrome. Also the original post states that this problem highly depends on the viewer :/ |
And evaluating (x, y, height, width) in python instead of having the SVG viewers interpret the transformation fixes it for all my applications...
|
I suspect the essence of this fix can and should be in image.py so that it doesn't have to be repeated in each backend. |
With interpolation="none", we cannot avoid using the matrix in the backend, and I doubt if pwuertz's solution will work for rotated and/or skewed images. |
It wouldn't have worked with any transformation but scaling, just wanted to share the observation that numerically the transformations shouldn't be doing stuff that exceeds a few orders of magnitudes as this seems to freak out some viewers. |
I think above PR seem to resolve the issue. Please test it and see if it works. |
@technobauble : Does the mentioned PR solve the issue for you? |
This appears to solve the problem for me in both the test cases that I posted and the actual application that I am developing. Thank you everyone for your time and the promptness of the fix. |
When writing out plots in vector graphics formats, the image data can be shifted relative to the axes window.
Here is a list of things I've noticed about the problem:
There have been a couple of emails about this on the users mailing list. Benjamin Root verified the problem. Eric Firing suggested that it might be a truncation error bug and suggested the following:
--Chad
Here are some scripts that can be used to reproduce the problem:
The text was updated successfully, but these errors were encountered: