diff --git a/doc/api/next_api_changes/deprecations/22317-AL.rst b/doc/api/next_api_changes/deprecations/22317-AL.rst new file mode 100644 index 000000000000..34147d534cdd --- /dev/null +++ b/doc/api/next_api_changes/deprecations/22317-AL.rst @@ -0,0 +1,8 @@ +seaborn styles renamed +~~~~~~~~~~~~~~~~~~~~~~ +Matplotlib currently ships many style files inspired from the seaborn +library ("seaborn", "seaborn-bright", "seaborn-colorblind", etc.) but they +have gone out of sync with the library itself since the release of seaborn +0.9. To prevent confusion, the style files have been renamed "seaborn0.8", +"seaborn0.8-bright", "seaborn0.8-colorblind", etc. Users are encouraged to +directly use seaborn to access the up-to-date styles. diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-bright.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-bright.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-bright.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-bright.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-colorblind.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-colorblind.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-colorblind.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-colorblind.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-dark-palette.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-dark-palette.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-dark-palette.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-dark-palette.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-dark.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-dark.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-dark.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-dark.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-darkgrid.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-darkgrid.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-darkgrid.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-darkgrid.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-deep.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-deep.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-deep.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-deep.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-muted.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-muted.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-muted.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-muted.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-notebook.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-notebook.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-notebook.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-notebook.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-paper.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-paper.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-paper.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-paper.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-pastel.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-pastel.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-pastel.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-pastel.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-poster.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-poster.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-poster.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-poster.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-talk.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-talk.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-talk.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-talk.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-ticks.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-ticks.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-ticks.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-ticks.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-white.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-white.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-white.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-white.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn-whitegrid.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8-whitegrid.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn-whitegrid.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8-whitegrid.mplstyle diff --git a/lib/matplotlib/mpl-data/stylelib/seaborn.mplstyle b/lib/matplotlib/mpl-data/stylelib/seaborn0.8.mplstyle similarity index 100% rename from lib/matplotlib/mpl-data/stylelib/seaborn.mplstyle rename to lib/matplotlib/mpl-data/stylelib/seaborn0.8.mplstyle diff --git a/lib/matplotlib/style/core.py b/lib/matplotlib/style/core.py index 85dcc8bc41fe..b30f7627eca9 100644 --- a/lib/matplotlib/style/core.py +++ b/lib/matplotlib/style/core.py @@ -102,17 +102,45 @@ def use(style): %s """ - style_alias = {'mpl20': 'default', - 'mpl15': 'classic'} if isinstance(style, (str, Path)) or hasattr(style, 'keys'): # If name is a single str, Path or dict, make it a single element list. styles = [style] else: styles = style - styles = (style_alias.get(s, s) if isinstance(s, str) else s - for s in styles) - for style in styles: + style_alias = {'mpl20': 'default', 'mpl15': 'classic'} + + def fix_style(s): + if isinstance(s, str): + s = style_alias.get(s, s) + if s in [ + "seaborn", + "seaborn-bright", + "seaborn-colorblind", + "seaborn-dark", + "seaborn-darkgrid", + "seaborn-dark-palette", + "seaborn-deep", + "seaborn-muted", + "seaborn-notebook", + "seaborn-paper", + "seaborn-pastel", + "seaborn-poster", + "seaborn-talk", + "seaborn-ticks", + "seaborn-white", + "seaborn-whitegrid", + ]: + _api.warn_deprecated( + "3.6", message="The seaborn styles shipped by Matplotlib " + "are deprecated since %(since)s, as they no longer " + "correspond to the styles shipped by seaborn. However, " + "they will remain available as 'seaborn0.8-