Skip to content

Commit

Permalink
fix some themes, especially using seaborn themes with matplotlib 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Dec 6, 2022
1 parent 616fa00 commit 5978b08
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions wxmplot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@

Themes = OrderedDict()

for tname in ('light', 'white-background', 'dark',
'matplotlib', 'seaborn', 'ggplot', 'bmh',
'fivethirtyeight', 'grayscale', 'dark_background',
'tableau-colorblind10', 'seaborn-bright',
'seaborn-colorblind', 'seaborn-dark', 'seaborn-darkgrid',
'seaborn-dark-palette', 'seaborn-deep', 'seaborn-notebook',
'seaborn-muted', 'seaborn-pastel', 'seaborn-paper',
'seaborn-poster', 'seaborn-talk', 'seaborn-ticks',
'seaborn-white', 'seaborn-whitegrid', 'Solarize_Light2'):

for tname in ('light', 'white-background', 'dark', 'matplotlib', 'ggplot',
'bmh', 'fivethirtyeight', 'grayscale', 'dark_background',
'tableau-colorblind10', 'Solarize_Light2', 'seaborn',
'seaborn-bright', 'seaborn-colorblind', 'seaborn-dark',
'seaborn-darkgrid', 'seaborn-dark-palette', 'seaborn-deep',
'seaborn-notebook', 'seaborn-muted', 'seaborn-pastel',
'seaborn-paper', 'seaborn-poster', 'seaborn-talk',
'seaborn-ticks', 'seaborn-white', 'seaborn-whitegrid'):
theme = rc_params()
theme['backend'] = 'WXAgg'
if tname == 'matplotlib':
Expand All @@ -151,14 +151,17 @@
elif tname == 'white-background':
theme.update(light_theme)
theme.update(whitebg_theme)
elif tname == 'fivethirtyeight': # text sizes are way off the norm
theme.update(matplotlib.style.library['fivethirtyeight'])
theme.update({'legend.fontsize': 10, 'xtick.labelsize': 9,
'ytick.labelsize': 9, 'axes.labelsize': 9,
'axes.titlesize': 13})
elif tname.startswith('seaborn'):
theme.update(matplotlib.style.library['seaborn'])
if '-' in tname:
theme.update(matplotlib.style.library[tname])
elif tname in matplotlib.style.library:
if tname.startswith('seaborn-'):
theme.update(matplotlib.style.library['seaborn'])
theme.update(matplotlib.style.library[tname])
if tname == 'fivethirtyeight__test': # text sizes are way off the norm
theme.update({'legend.fontsize': 10, 'xtick.labelsize': 9,
'ytick.labelsize': 9, 'axes.labelsize': 9,
'axes.titlesize': 13})
Themes[tname.lower()] = theme

def ifnot_none(val, default):
Expand Down

0 comments on commit 5978b08

Please sign in to comment.