-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Exporting figure as pdf using savefig() messes up axis background in OS X #1894
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
Conversation
Seems to be unrelated to macosx (which isn't used to produce PDFs). Looking into it now. |
Can you confirm that the attached patch resolves your issue? |
Thanks for the clarification on the backend. I'll test this tomorrow and let you know. |
@@ -820,7 +820,7 @@ | |||
pixfmt pixf(*imo->rbufOut); | |||
renderer_base rb(pixf); | |||
|
|||
rb.clear(agg::rgba(1, 1, 1, 1)); | |||
rb.clear(agg::rgba(1, 1, 1, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine by me, but I wonder why we need to set the RGB to 1? Is there a similar solution here to the one proposed in #1868?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah -- at the end of the day, it doesn't matter, but maybe it does make sense to be consistent with #1868. I'll fix this up.
👍 LGTM. |
👍 This commit resolves my issue. Thanks for the prompt fix! Note: I can't believe compilation on OS X is so simple these days. I used to patch make.osx before I could do anything, which generally meant looking for the latest links to the dependencies. I guess |
Apologies, closed by mistake. I'm assuming you'll close this issue when merging the pull request. |
Yep. @mdboom - I wonder if it is worth having some alpha in the axis background, just to test that it is working. I also wonder whether we should use some colour in the actual images being drawn, perhaps simply |
@pelson: Good suggestions. Done. |
Fixes background coloring of multiple images on the same axes.
Cool. Don't forget to cite us: http://matplotlib.org/citing.html 😉 |
Will not! ✌️ |
I'm trying to change the axis background on a plot where several imshow() calls render images in various locations via the extent parameter.
When I save a pdf of the figure using savefig(), I lose the background color if the axis displays more than one image. Note that this doesn't happen when exporting a png of the same figure.
Example code and the corresponding output [stackoverflow.com].
Could this be a bug with the MacOSX backend I'm using?
Note: I'm using matplotlib 1.2.1 installed via
pip
running on Python 2.7.4