Skip to content

Commit

Permalink
colors: Add MatplotlibDefault palette
Browse files Browse the repository at this point in the history
  • Loading branch information
wookayin committed Nov 7, 2023
1 parent b589db5 commit 5e8c497
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion expt/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,23 @@
del sys
del _thismodule

# Matplotlib default cycle
MatplotlibDefault = (
'#1f77b4',
'#ff7f0e',
'#2ca02c',
'#d62728',
'#9467bd',
'#8c564b',
'#e377c2',
'#7f7f7f',
'#bcbd22',
'#17becf',
)

# Sensible default color sets that are more distinguishable: 17 colors
# https://matplotlib.org/3.1.0/gallery/color/named_colors.html
DefaultColors = (
ExptSensible17 = (
'dimgray',
'dodgerblue',
'limegreen',
Expand Down
4 changes: 2 additions & 2 deletions expt/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,8 +961,8 @@ def __call__(

if 'color' not in axes_props[0].keys():
# axes.prop_cycle does not have color. Fall back to default colors
from .colors import DefaultColors
color_it = itertools.cycle(DefaultColors)
from .colors import ExptSensible17
color_it = itertools.cycle(ExptSensible17)
for prop, c in zip(axes_props, color_it):
prop['color'] = c

Expand Down

0 comments on commit 5e8c497

Please sign in to comment.