Skip to content

Using default style raises warnings about non style parameters #5777

Closed

Description

@jenshnielsen

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

Activity

  1. jenshnielsen commented on Jan 1, 2016

    @jenshnielsen
    MemberAuthor

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

  2. added this to the milestone on Jan 1, 2016
  3. mdboom commented on Jan 1, 2016

    @mdboom
    Member

    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.

  4. efiring commented on Jan 1, 2016

    @efiring
    Member

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

  5. jenshnielsen commented on Jan 1, 2016

    @jenshnielsen
    MemberAuthor

    @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.

  6. mdboom commented on Jan 1, 2016

    @mdboom
    Member

    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.

  7. jenshnielsen commented on Jan 1, 2016

    @jenshnielsen
    MemberAuthor

    Cool Im happy to do a PR with that now

  8. added a commit that references this issue on Jan 1, 2016
    21b129f
  9. self-assigned this
    on Jan 1, 2016
  10. mdboom commented on Jan 1, 2016

    @mdboom
    Member

    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.

  11. jenshnielsen commented on Jan 1, 2016

    @jenshnielsen
    MemberAuthor

    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

  12. added a commit that references this issue on Jan 5, 2016
    fe701e3
  13. added a commit that references this issue on Jan 5, 2016
    b68d050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions