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

Skip to content

Commit c277c78

Browse files
committed
Rename outdated seaborn styles.
... while keeping them available under a versioned name for backcompat.
1 parent fd51e05 commit c277c78

17 files changed

+33
-5
lines changed

lib/matplotlib/style/core.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,45 @@ def use(style):
102102
103103
%s
104104
"""
105-
style_alias = {'mpl20': 'default',
106-
'mpl15': 'classic'}
107105
if isinstance(style, (str, Path)) or hasattr(style, 'keys'):
108106
# If name is a single str, Path or dict, make it a single element list.
109107
styles = [style]
110108
else:
111109
styles = style
112110

113-
styles = (style_alias.get(s, s) if isinstance(s, str) else s
114-
for s in styles)
115-
for style in styles:
111+
style_alias = {'mpl20': 'default', 'mpl15': 'classic'}
112+
113+
def fix_style(s):
114+
if isinstance(s, str):
115+
s = style_alias.get(s, s)
116+
if s in [
117+
"seaborn",
118+
"seaborn-bright",
119+
"seaborn-colorblind",
120+
"seaborn-dark",
121+
"seaborn-darkgrid",
122+
"seaborn-dark-palette",
123+
"seaborn-deep",
124+
"seaborn-muted",
125+
"seaborn-notebook",
126+
"seaborn-paper",
127+
"seaborn-pastel",
128+
"seaborn-poster",
129+
"seaborn-talk",
130+
"seaborn-ticks",
131+
"seaborn-white",
132+
"seaborn-whitegrid",
133+
]:
134+
_api.warn_deprecated(
135+
"3.6", message="The seaborn styles shipped by Matplotlib "
136+
"are deprecated since %(since)s, as they no longer "
137+
"correspond to the styles shipped by seaborn. However, "
138+
"they will remain available as 'seaborn0.8-<style>'. "
139+
"Alternatively, directly use the seaborn API instead.")
140+
s = s.replace("seaborn", "seaborn0.8")
141+
return s
142+
143+
for style in map(fix_style, styles):
116144
if not isinstance(style, (str, Path)):
117145
_apply_style(style)
118146
elif style == 'default':

0 commit comments

Comments
 (0)