Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

mdboom
Copy link
Member

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 viapip running on Python 2.7.4

@mdboom
Copy link
Member

Seems to be unrelated to macosx (which isn't used to produce PDFs). Looking into it now.

mdboom added a commit to mdboom/matplotlib that referenced this pull requestApr 10, 2013
@mdboom
Copy link
Member

Can you confirm that the attached patch resolves your issue?

@fgb
Copy link
ContributorAuthor

fgb commentedApr 11, 2013

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));
Copy link
Member

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?

Copy link
MemberAuthor

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.

mdboom added a commit to mdboom/matplotlib that referenced this pull requestApr 11, 2013
@pelson
Copy link
Member

👍 LGTM.

mdboom added a commit to mdboom/matplotlib that referenced this pull requestApr 11, 2013
@fgb
Copy link
ContributorAuthor

fgb commentedApr 11, 2013

👍 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 guessbrew came to the rescue.

@fgbfgb closed thisApr 11, 2013
@fgbfgb reopened thisApr 11, 2013
@fgb
Copy link
ContributorAuthor

fgb commentedApr 11, 2013

Apologies, closed by mistake. I'm assuming you'll close this issue when merging the pull request.

@pelson
Copy link
Member

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 simplyarr = np.arange(12).reshape(3, 4)?

@mdboom
Copy link
Member

@pelson: Good suggestions. Done.

pelson added a commit that referenced this pull requestApr 12, 2013
Fixes background coloring of multiple images on the same axes.
@pelsonpelson merged commitb9d3422 intomatplotlib:v1.2.xApr 12, 2013
@pelson
Copy link
Member

Thanks for reporting@fgb - this will be fixed in v1.3.

Nice work@mdboom.

@fgb
Copy link
ContributorAuthor

fgb commentedApr 12, 2013

My pleasure. Now I'll be able to include the relevant figures in PDF in my dissertation instead of relying on PNGs. Thanks@mdboom,@pelson!

@pelson
Copy link
Member

Now I'll be able to include the relevant figures in PDF in my dissertation instead of relying on PNGs

Cool. Don't forget to cite us:http://matplotlib.org/citing.html 😉

@fgb
Copy link
ContributorAuthor

fgb commentedApr 12, 2013

Will not! ✌️

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
v1.2.x
Development

Successfully merging this pull request may close these issues.

3 participants
@mdboom@fgb@pelson

[8]ページ先頭

©2009-2025 Movatter.jp