Skip to content

Commit

Permalink
Merge pull request #14 from nschloe/replace-tab
Browse files Browse the repository at this point in the history
Replace tab
  • Loading branch information
nschloe committed Dec 2, 2021
2 parents d164eff + 6326dd0 commit b21cf12
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = matplotx
version = 0.2.2
version = 0.2.3
author = Nico Schlömer
author_email = nico.schloemer@gmail.com
description = Extensions for Matplotlib
Expand Down
46 changes: 16 additions & 30 deletions src/matplotx/styles/_tableau.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""
https://www.tableau.com/about/blog/2016/7/colors-upgrade-tableau-10-56782
https://jrnold.github.io/ggthemes/reference/tableau_color_pal.html
The tableau colors have been revised in [1], but it's unclear where they can be
used (see [2]). Hence, just provide a reordering of the tab20 colors that are in matplotlib.
[1] https://www.tableau.com/about/blog/2016/7/colors-upgrade-tableau-10-56782
[2] https://jrnold.github.io/ggthemes/reference/tableau_color_pal.html
"""
import matplotlib as mpl

Expand All @@ -13,36 +16,19 @@ def _transpose(list_of_lists):
return list(map(list, zip(*list_of_lists)))


tab10 = {
"axes.prop_cycle": mpl.cycler(
color=[
"4e79a7", # blue
"f28e2b", # orange
"e15759", # red
"76b7b2", # teal
"59a14f", # green
"edc948", # yellow
"b07aa1", # purple
"ff9da7", # rose
"9c755f", # brown
"bab0ac", # grey
]
),
}

# colors plus light variant; some are the same as tab10
tab20_colors = [
["4e79a7", "a0cbe8"], # blue
["f28e2b", "ffbe7d"], # orange
["59a14f", "8cd17d"], # green
["b6992d", "f1ce63"], # yellow
["499894", "86bcb6"], # teal
["e15759", "ff9d9a"], # red
["79706e", "bab0ac"], # grey
["d37295", "fabfd2"], # rose
["b07aa1", "d4a6c8"], # purple
["9c7660", "d7b5a6"], # brown
["1f77b4", "aec7e8"], # blue
["ff7f0e", "ffbb78"], # orange
["2ca02c", "98df8a"], # green
["d62728", "ff9896"], # red
["9467bd", "c5b0d5"], # purple
["8c564b", "c49c94"], # brown
["e377c2", "f7b6d2"], # pink
["7f7f7f", "c7c7c7"], # gray
["bcbd22", "dbdb8d"], # yellow
["17becf", "9edae5"], # teal
]
tab10 = {"axes.prop_cycle": mpl.cycler(color=[row[0] for row in tab20_colors])}
tab20 = {"axes.prop_cycle": mpl.cycler(color=_flatten(tab20_colors))}
# like tab20, but reordered such that the light variants come last
tab20r = {"axes.prop_cycle": mpl.cycler(color=_flatten(_transpose(tab20_colors)))}

0 comments on commit b21cf12

Please sign in to comment.