Updated 3 Feb 2019
The colors created by Paul Tol at SRON are good for publication-quality figures:
- distinct for all people, including color-blind readers
- distinct from black and white
- distinct on screen and paper
- still match well together
ptc6 calls up to 6 RGB colors.
use ptc12 if more colors are needed (up to 12).
ptc6(n) % n is the number of distinct colors
(a light gray is added at n+1)
To visualize each scheme of color selected, add 'check' to the function:
ptc6(3, 'check') % displays the 3 colors on a figure
Nans Bujan (2023). Tol colors (https://www.mathworks.com/matlabcentral/fileexchange/70180-tol-colors), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired: Maximally Distinct Color Generator
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.