Skip to content
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

Added custom rcParam context manager #1300

Merged
merged 2 commits into from
Apr 17, 2017
Merged

Added custom rcParam context manager #1300

merged 2 commits into from
Apr 17, 2017

Conversation

philippjfr
Copy link
Member

For some reason the context manager to set rcParams provided by matplotlib is not working correctly, I've implemented a tiny one of our own here which fixes the bug mentioned in #1299.

@@ -19,12 +20,27 @@
from .util import compute_ratios, fix_aspect


@contextmanager
def rc_context(rcparams):
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid confusion maybe this should be _rc_context if we expect to use the decorator and not this context manager directly. Perhaps you could even inline this context manager inside mpl_rc_context?

Copy link
Member Author

Choose a reason for hiding this comment

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

Inlining seems inefficient but I'll happily rename.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it is at all inefficient to inline - decorators are only applied once at definition time.

@jlstevens
Copy link
Contributor

Looks good apart from one comment. It is suspicious that the context manager supplied by matplotlib doesn't seem to work right...

@basnijholt
Copy link
Contributor

This fix seems to work for me 👍

@jlstevens
Copy link
Contributor

Looks good. Merging.

@jlstevens jlstevens merged commit 078de8b into master Apr 17, 2017
@philippjfr philippjfr deleted the mpl_rccontext branch April 19, 2017 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: backend: mpl tag: component: plotting type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants