8000 Fix #4855: Blacklist rcParams that aren't style by mdboom · Pull Request #5440 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix #4855: Blacklist rcParams that aren't style #5440

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

Merged
merged 6 commits into from
Dec 31, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix, per comments in PR
  • Loading branch information
mdboom committed Nov 9, 2015
commit 22f99bb171c9c2bc3e4f2204921ba6e284b598cb
15 changes: 12 additions & 3 deletions lib/matplotlib/style/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import re
import contextlib
import warnings

import matplotlib as mpl
from matplotlib import cbook
Expand All @@ -42,8 +43,16 @@
'savefig.directory', 'tk.window_focus', 'hardcopy.docstring'])
Copy link
Member

Choose a reason for hiding this comment

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

what about the default keymappings?

Copy link
Member Author

Choose a reason for hiding this comment

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

In that case, I thought using style might be handy, e.g. an Emacs key style (not that one could do that given our current framework, but you get the idea).



def _blacklist_style_params(d):
return dict((k, v) for (k, v) in d.items() if k not in STYLE_BLACKLIST)
def _remove_blacklisted_style_params(d):
o = {}
for key, val in d.items():
if key in STYLE_BLACKLIST:
warnings.warn(
"Style includes a parameter, '{0}', that is not related to "
"style. Ignoring".format(key))
else:
o[key] = val
return o


def is_style_file(filename):
Expand All @@ -52,7 +61,7 @@ def is_style_file(filename):


def _apply_style(d):
mpl.rcParams.use(blacklist_style_params(d))
mpl.rcParams.use(_remove_blacklisted_style_params(d))


def use(style):
Expand Down
0