Skip to content

Transparent rcparams - #2390

Merged
dmcdougall merged 4 commits into
matplotlib:masterfrom
tacaswell:transparent_rcparams
Sep 8, 2013
Merged

dmcdougall merged 4 commits into
matplotlib:masterfrom
tacaswell:transparent_rcparams

Conversation

@tacaswell

Copy link
Copy Markdown
Member

Addresses issue #2388

is passed to `savefig`, the patch colors are restored on the screen
after saving.
Comment thread lib/matplotlib/pyplot.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why this is needed. Forgetting the rcParam, what's the difference if I just pass tansparent=True to savefig manually?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is only tangentally related to the rcParams work.

I noticed while testing with transparent=True in an interactive backend (qt4) that after the save the background patch was still invisible. The savefig code does restore the correct colors, but the display never got updated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that comfortable with this change. A quicker alternative might be to capture a frame buffer and fire it back at the canvas. @mdboom do you have any insight?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to use draw_if_interactive? Which now that I think a bit more about it is what I should have done to begin with.

@dmcdougall

Copy link
Copy Markdown
Member

Aside from a little clarification needed on my part, I'm all for this change.

Thanks @tacaswell.

As suggested by @dmcdougall
Comment thread doc/api/api_changes.rst

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is actually a new feature, it should probably be added to whats_new.rst as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@mdboom

mdboom commented Sep 7, 2013

Copy link
Copy Markdown
Member

👍

dmcdougall added a commit that referenced this pull request Sep 8, 2013
@dmcdougall
dmcdougall merged commit 8a3a4df into matplotlib:master Sep 8, 2013
@efiring

efiring commented Sep 8, 2013

Copy link
Copy Markdown
Member

I'm jumping in late, sorry. I think more work is needed to clean this up. The basic background and edge color handling is being done in backend_bases, FigureCanvasBase.print_figure(). Then transparency is handled as a special case in Figure.savefig, and one more fiddle for transparency (but being done regardless of whether it is needed) is in pyplot. Some rationalization and consolidation is needed.

@dmcdougall

Copy link
Copy Markdown
Member

Oh my. I thought this was a simple addition to the codebase. I should have left this open for a little longer to garner feedback before merging. Sorry if I've stepped on any toes here.

Shall I go ahead and open a separate issue regarding the call to draw(), so we can further investigate this?

@efiring

efiring commented Sep 8, 2013

Copy link
Copy Markdown
Member

OK. But the issue is not really the call to draw(), it is the overall factoring: I think printed transparency should be handled together with the rest of the print-versus-display shuffle, which is in print_figure, and any extra draw operation following the printing operation should be executed only when it is actually needed. This is my impression based on a very quick look, so I might be missing something. (Of course if I looked long and hard, I might still miss something...)

@mdboom

mdboom commented Sep 9, 2013

Copy link
Copy Markdown
Member

Agreed with @efiring above.

@tacaswell
tacaswell deleted the transparent_rcparams branch September 11, 2013 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants