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

Using default style raises warnings about non style parameters #5777

Closed
jenshnielsen opened this issue Jan 1, 2016 · 8 comments
Closed

Using default style raises warnings about non style parameters #5777

jenshnielsen opened this issue Jan 1, 2016 · 8 comments
Assignees
Milestone

Comments

@jenshnielsen
Copy link
Member

For instance:

import matplotlib
import matplotlib.pyplot as plt

matplotlib.style.use('default')
plt.plot(range(10))
plt.show()

raises

/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'webagg.port_retries', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'datapath', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'figure.max_open_warning', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'timezone', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'backend.qt4', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'toolbar', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'savefig.directory', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'tk.window_focus', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'backend_fallback', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'webagg.open_in_browser', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'backend', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'interactive', that is not related to style.  Ignoring
  "style.  Ignoring".format(key))
/usr/local/lib/python3.5/site-packages/matplotlib/style/core.py:52: UserWarning: Style includes a parameter, 'webagg.port', that is not related to style.  Ignoring
@jenshnielsen
Copy link
Member Author

This happens every time the test suite runs a test with the default style rather than the classic style after the merge of #5440

@jenshnielsen jenshnielsen added this to the next major release (2.0) milestone Jan 1, 2016
@mdboom
Copy link
Member

mdboom commented Jan 1, 2016

I think this is due to the 11th hour addition of d9d1671 in #5440. Obviously that will have to be done differently -- probably to ignore, but not warn about, blacklisted parameters.

@efiring
Copy link
Member

efiring commented Jan 1, 2016

But ordinarily one would want the warning, so maybe a warn=True kwarg is needed, that can be set to False in d9d1671.

@jenshnielsen
Copy link
Member Author

@efiring I agree. I think it would be ok to add a warn kwarg to _apply_style and pass it on to _remove_blacklisted_style_params which defaults to True and just set this to False when the default style is used.

@mdboom
Copy link
Member

mdboom commented Jan 1, 2016

Yes -- I am only suggesting suppressing the warning when default is applied, which by necessity must have blacklisted parameters in it that should be ignored when using it as a style.

@jenshnielsen
Copy link
Member Author

Cool Im happy to do a PR with that now

@mdboom mdboom self-assigned this Jan 1, 2016
@mdboom
Copy link
Member

mdboom commented Jan 1, 2016

Sorry -- didn't see your comment before I just made a PR (#5778). We can do that, or use a kwarg to disable warnings, as you suggest. I don't really have strong feelings either way.

@jenshnielsen
Copy link
Member Author

Neither do I but I guess #5778 requires slightly less modification so I will merge that when travis passes and we are sure it works

@mdboom mdboom closed this as completed in 21b129f Jan 5, 2016
jenshnielsen added a commit that referenced this issue Jan 5, 2016
Fix #5777.  Don't warn when applying default style
jenshnielsen added a commit to jenshnielsen/matplotlib that referenced this issue Jan 5, 2016
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

No branches or pull requests

3 participants