Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Restore (and warn on) seaborn styles in style.library #24265

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 1 commit into from
Oct 25, 2022

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Oct 25, 2022

PR Summary

Fixes #24264

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [n/a] New features are documented, with examples if plot related.
  • [n/a] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [n/a] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [n/a] Documentation is sphinx and numpydoc compliant (the docs should build without error).

@@ -184,6 +184,8 @@ def test_deprecated_seaborn_styles():
with pytest.warns(mpl._api.MatplotlibDeprecationWarning):
mpl.style.use("seaborn-bright")
assert mpl.rcParams == seaborn_bright
with pytest.warns(mpl._api.MatplotlibDeprecationWarning):
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain this? You just tested this three lines above - do we understand why that test passed?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's style.use, this is style.library.

Copy link
Member

Choose a reason for hiding this comment

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

Ah...

OTOH, do we expect users to access style.library? Should this be private, or is it useful to expose?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if we expect them to or not, but we already have the bug report from a user, so it is being used. It is also documented, at least a little, in the module docstring. In any case, this is only the bug fix for now.

available = []


def reload_library():
"""Reload the style library."""
global library
library = update_user_library(_base_library)
library.update(update_user_library(_base_library))
Copy link
Contributor

Choose a reason for hiding this comment

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

To match previous semantics, library should be cleared first?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.

@jklymak
Copy link
Member

jklymak commented Oct 25, 2022

Leaving open if @anntzer wants another quick look. Otherwise, @QuLogic feel free to self-merge

@anntzer anntzer merged commit 3811658 into matplotlib:main Oct 25, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Oct 25, 2022
@QuLogic QuLogic deleted the seaborn-library branch October 25, 2022 19:05
QuLogic added a commit that referenced this pull request Oct 25, 2022
…265-on-v3.6.x

Backport PR #24265 on branch v3.6.x (Restore (and warn on) seaborn styles in style.library)
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Setting matplotlib.pyplot.style.library['seaborn-colorblind'] result in key error on matplotlib v3.6.1
4 participants