Skip to content

Instantly share code, notes, and snippets.

@AndiH
Last active April 22, 2022 14:33
Show Gist options
  • Save AndiH/c957b4d769e628f506bd to your computer and use it in GitHub Desktop.
Save AndiH/c957b4d769e628f506bd to your computer and use it in GitHub Desktop.
Tableau 20 and TableauColor Blind 10 Colors
# Tableau 20 Colors
tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120),
(44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150),
(148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148),
(227, 119, 194), (247, 182, 210), (127, 127, 127), (199, 199, 199),
(188, 189, 34), (219, 219, 141), (23, 190, 207), (158, 218, 229)]
# Tableau Color Blind 10
tableau20blind = [(0, 107, 164), (255, 128, 14), (171, 171, 171), (89, 89, 89),
(95, 158, 209), (200, 82, 0), (137, 137, 137), (163, 200, 236),
(255, 188, 121), (207, 207, 207)]
# Rescale to values between 0 and 1
for i in range(len(tableau20)):
r, g, b = tableau20[i]
tableau20[i] = (r / 255., g / 255., b / 255.)
for i in range(len(tableau20blind)):
r, g, b = tableau20blind[i]
tableau20blind[i] = (r / 255., g / 255., b / 255.)
# Use with plt.plot(…, color=tableau[0],…)
# From http://tableaufriction.blogspot.ro/2012/11/finally-you-can-use-tableau-data-colors.html
# With code from http://www.randalolson.com/2014/06/28/how-to-make-beautiful-data-visualizations-in-python-with-matplotlib/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment