-
-
Save thriveth/8560036 to your computer and use it in GitHub Desktop.
CB_color_cycle = ['#377eb8', '#ff7f00', '#4daf4a', | |
'#f781bf', '#a65628', '#984ea3', | |
'#999999', '#e41a1c', '#dede00'] |
Same, I wouldn't say no to a bigger palette, I regularly need just a few more colours (around 12).
In case anyone seeing this thread wondered what the colours look like, below is a quick plot of them.
Thanks @thriveth, your colour cycle has been very useful in my work.
And if you want to convert to rgba
for e.g., plotly, here are the rgb values:
opacity = 0.5
colors = {
'blue': [55, 126, 184], #377eb8
'orange': [255, 127, 0], #ff7f00
'green': [77, 175, 74], #4daf4a
'pink': [247, 129, 191], #f781bf
'brown': [166, 86, 40], #a65628
'purple': [152, 78, 163], #984ea3
'gray': [153, 153, 153], #999999
'red': [228, 26, 28], #e41a1c
'yellow': [222, 222, 0] #dede00
}
c_str = {k:f'rgba({v[0]},{v[1]},{v[2]},{opacity})'
for (k, v) in colors.items()}
c_str['yellow'] # Gives the rgba string for 'yellow'
Sometimes it is handy to have the list with colors also for matplotlib. If you want to color one plot by hand.
colors = {
'blue': '#377eb8',
'orange': '#ff7f00',
'green': '#4daf4a',
'pink': '#f781bf',
'brown': '#a65628',
'purple': '#984ea3',
'gray': '#999999',
'red': '#e41a1c',
'yellow': '#dede00'
}
Note that this list describes "category-10"
... and there is a related list with 20 unique colors
Funny enough: matplotlib has already implemented the category10 color as a standard mode in version 2.0.
however if you do something like this:
matplotlib.pyplot.plot(x,y, color = 'blue')
the old basic color will be used. So beware. New notation of category10 is as shown here:
matplotlib.pyplot.plot(x,y, color = 'C0')
Just for the sake of completeness in case someone stumbles over this old question like I did today.
Thanks for your answer @swharden , without it I wouldn't know category10 colors.
They are very great!
Would be nice to have some more :-) How did you choose them?