A repository to store color palettes for plots in all programming languages and programs. The focus is on schemes that are perceptually uniform and were designed with colorblindness in mind. This repository is meant to be accessible on multiple levels, whether you are just starting out in a particular programming language or a seasoned veteran. Each program is divided into two sections, the "copy paste" method and the "integrated" solution. The "copy and paste" method will allow you to copy and paste a few lines of code to make your work colorblind friendly. The "integrated" solution will change the default plot options for a program so that it will always create material that is colorblind friendly.
The first step in implementing any of these is to first send an email to the provider of your software and request that they change the default sequence to be colorblind friendly. The majority of the population will only use them if they are the defaults, and only the software providers can accomplish this.
Credit should be given where it is due. I have not developed any of these color schemes, I am merely trying to organize them into a format that is easily accessible for all creators. The following is a list of sources where I got these palettes. They are organized roughly by when I became aware of them.
- http://mk.bcgsc.ca/colorblind/#10home - Martin Krzywinski (also http://mk.bcgsc.ca/brewer/)
- http://colorbrewer2.org/ - Cynthia Brewer and Mark Harrower
- https://sronpersonalpages.nl/~pault - Paul Tol
- https://github.com/mpetroff/accessible-color-cycles?tab=readme-ov-file - Matthew Petroff
-
Okabe and Ito (https://jfly.uni-koeln.de/color/)
Color name R (dec) G (dec) B (dec) R (hex) G (hex) B (hex) RGB (hex) RGBA (hex) Black 0 0 0 00 00 00 000000 000000ff Orange 230 159 0 e6 9f 00 e69f00 e69f00ff Sky blue 86 180 233 56 b4 e9 56b4e9 56b4e9ff Bluish green 0 158 115 00 9e 73 009e73 009e73ff Yellow 240 228 66 f0 e4 42 f0e442 f0e442ff Blue 0 114 178 00 72 b2 0072b2 0072b2ff Vermillion 213 94 0 d5 5e 00 d55e00 d55e00ff Reddish purple 204 121 167 cc 79 a7 cc79a7 cc79a7ff -
Martin K. 12 Alt
Name R (dec) G (dec) B (dec) R (hex) G (hex) B (hex) RGB (hex) RGBA (hex) genoa 00 106 94 00 6A 5E 006A5E 006A5EFF deeppink 237 13 136 ED 0D 88 ED0D88 ED0D88FF tealish 00 189 169 00 BD A9 00BDA9 00BDA9FF palecrimson 255 196 212 FF C4 D4 FFC4D4 FFC4D4FF ceruleanblue 00 88 204 00 58 CC 0058CC 0058CCFF hotpurple 210 80 251 D2 80 FB D208FB D208FBFF pinkflamingo 255 102 253 FF 66 FD FF66FD FF66FDFF turquoise 00 239 249 00 EF F9 00EFF9 00EFF9FF japaneselaurel 21 109 30 15 6D 30 156D03 156D03FF islamicgreen 00 151 25 00 97 19 009719 009719FF permanentgreen 00 198 27 00 C6 1B 00C61B 00C61BFF luminous 00 251 29 00 FB 1D 00FB1D 00FB1DFF -
Petroff 6
I took the liberty of renaming the colors so they have unique names.
Name R (dec) G (dec) B (dec) R (hex) G (hex) B (hex) RGB (hex) RGBA (hex) blue 87 144 252 57 90 FC 5790FC 5790FCFF orange 248 156 32 F8 9C 20 F89C20 F89C20FF red 228 37 54 E4 25 36 E42536 E42536FF plum 150 74 139 96 4A 8B 964A8B 964A8BFF gray 156 156 161 9C 9C A1 9C9CA1 9C9CA1FF purple 122 33 221 7A 21 DD 7A21DD 7A21DDFF
For all of these implementations, I will provide the text input for the Wong 2011 palette on this page. In the future, I hope to have a python script that will allow for generation of any of the palettes in any of the languages.
There are so many ways to define colors in matplotlib, this will likely always be a work in progress. Pull requests with your favorite way to define colors are welcome.
Execute the following two commands before your plot statements, and the default color sequence will be set to Okabe and Ito.
ax = plt.axes()
ax.set_prop_cycle(color=['000000','e69f00','56b4e9','009e73','f0e442','0072b2','d55e00','cc79a7'])
We need to put a few lines of code into the matplotlibrc file. This probably doesn't exist, so you'll need to make it in the proper directory. Consult the link above to be sure, but in your home directory, there should be a folder called ".matplotlib". It might be hidden so make sure to unhide files and folder in your folder view settings. Inside that folder, make a new file called "matplotlib.txt". Open that file and paste in the following text.
axes.prop_cycle: cycler('color', ['000000','e69f00','56b4e9','009e73','f0e442','0072b2','d55e00','cc79a7'])
Save the file, then change the name of the file, removing the ".txt" extension at the end. You'll get a warning message, say "Yes" you're sure you want to change it. If you need to edit the file later, you can just add the ".txt" extension back to the file to be able to open it in a text editor.
Mathematica is where I do the majority of my work, so it will be the first program to be filled out.
To any plot, add the paste in the following list of colors as the argument for PlotStyle
For example: ListPlot[{{1,2,3},{4,5,6}},PlotStyle->{RGBColor[0/255,0/255,0/255],...}]
{RGBColor[0/255,0/255,0/255], (* Black *)
RGBColor[230/255,159/255,0], (* Orange *)
RGBColor[86/255,180/255,233/255], (* Light Blue *)
RGBColor[0/255,158/255,115/255], (* Teal *)
RGBColor[240/255,228/255,66/255], (* Yellow *)
RGBColor[0/255,114/255,178/255], (* Royal Blue *)
RGBColor[213/255,94/255,0/255], (* Vermillion *)
RGBColor[204/255,121/255,167/255] (* Pink *)
}Every time the Mathematica Kernel starts, it runs the commands stored in an initialization file. We can store commands within this file and cause the default plot color sequence to be the colorblind palette. First, find the location of the Kernel folder on your installation. Regardless of the platform you're on, you can find this with SystemOpen@FileNameJoin[{$UserBaseDirectory, "Kernel"}]
Then place this file in the directory you found.
If Mathematica is currently running, either kill the Kernel or close out of Mathematica and open it back up and your default color sequence should be set.
I think there has to be an easier way to do this, so if you know of one, please inform me!
I do a small amount of auto-generation of plots in gnuplot. Since it's text based, the copy paste and integrated solutions are essentially the same.
If you have a gnuplot script that is generating the plots, copy and paste these commands into the script above where the plot is generated.
Gnuplot version 5 introduced the podo color sequence, which is the Okabe and Ito color sequence. If you are in Gnuplot 5 you can simply set the color sequence to podo like this:
set colorsequence podoOn older versions of Gnuplot, specify the colors manually:
set linetype 1 lc rgb 0x000000 lw 2
set linetype 2 lc rgb 0xe69f00 lw 2
set linetype 3 lc rgb 0x56b4e9 lw 2
set linetype 4 lc rgb 0x009e73 lw 2
set linetype 5 lc rgb 0xf0e442 lw 2
set linetype 6 lc rgb 0x0072b2 lw 2
set linetype 7 lc rgb 0xd55e00 lw 2
set linetype 8 lc rgb 0xcc79a7 lw 2
set linetype cycle 8Copy and paste the following lines into the gnuplot configuration file, default location: "~/.gnuplot". This configuration file might also need to be copied to the root user's home directory "/root/.gnuplot", if you run scripts with root when you collect data. If you are on Gnuplot 5, use the podo color sequence:
set colorsequence podoOtherwise, specify the colors manually:
set linetype 1 lc rgb 0x000000 lw 2
set linetype 2 lc rgb 0xe69f00 lw 2
set linetype 3 lc rgb 0x56b4e9 lw 2
set linetype 4 lc rgb 0x009e73 lw 2
set linetype 5 lc rgb 0xf0e442 lw 2
set linetype 6 lc rgb 0x0072b2 lw 2
set linetype 7 lc rgb 0xd55e00 lw 2
set linetype 8 lc rgb 0xcc79a7 lw 2
set linetype cycle 8Inkscape is great for preparing 2D drawings, and is an alternative to Adobe Illustrator.
Inkscape doesn't seem to have a place to copy and paste a list of RGB values. You can specify individual colors from the RGB values in the table above, but given the nature of editing on inkscape, I think it makes the most sense to just provide this image of the colors.
Which can be copied and pasted into your inkscape file and then the eyedropper tool can be used to pick out the colors.
Save this file (right click link > "Save link as...") into the directory:
- On Windows: "C:\Program Files\Inkscape\share\palettes"
The next time you open Inkscape, you will be able to select the palette by clicking on the arrow in the bottom right hand corner next to the colors.
Love it or hate it, it's probably the most popular program to create data visualizations. Though I tried, I couldn't seem to find a way to default the colors to a custom option. The best I can do is to configure the program so that it allows you to easily select the palette after the program has started.
Save this theme file (right click link > "Save link as...") where you can find it, then in the Office Ribbon go to "Design > Themes > Browse for Themes" and select the file you just downloaded.
Save the same file as above (right click link > "Save link as...") into the Templates directory. It can be found at (make sure "hidden items" are shown) "\AppData\Roaming\Microsoft\Templates\Document Themes". Now whenever you open a Microsoft product, you should be able to go to "Design > Themes > Theme1" and have access to the colors.
