The short names and long names are character vectors that specify one of eight predefined colors. The RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color; the intensities must be in the range 0 1. Sometimes you'll want a color that's not one of the defaults. It's very easy to use any RGB color code to create any color you want. You'll want to use the 'Color'.
Posted by6 years ago
Archived
Summary
Matlab's default 'Jet' colormap will obscure real patterns while showing you imaginary ones; example. The default line color styles are hard to distinguish and hard to even see!
The problem
Humans are not equally perceptive to all colors. Jet is just the most simple way possible to move through color space; graph here. Experts have designed color schemes in which two colors are spaced out equally in perceptual space making for an artifact free colormap; graph here.
![Color Color](https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/34087/versions/2/screenshot.jpg)
The solution:
- linspecer this is a handpicked mixture of colorbrewer schemes packaged to be easy to use. Pass it 'N' and you will get N distinguishable colors. Pass it nothing and you have a colormap. (Full disclosure this is my file, comments/criticism welcome).
- cbrewer will give you every colobrewer option ever. This is your expert option, you need to know the names of the scheme you want and are ready to modify the schemes yourself to make the yellow's darker.
- colorbrewer is the gold standard for colormaps, by cynthia brewer. The two files above make colorbrewer trivial to implement in Matlab, but the colorbrewer online user interface is easy to use too.
- lbmap has four colormaps for the colorblind and is really easy to use.
- haxby is most similar to jet, designed for marine maps. Isn't as good as the options above but far better than the default.
- varycolor Does not provide well spaced colors. use linspecer or cbrewer instead.
Use examples (thx tedwick)
- colormap(linspecer);
Replace the default colormap:
- set(0,'DefaultFigureColormap',linspecer);
- set(0,'DefaultFigureColormap',cbrewer('seq','YlOrRd',64));
Set the color order separately for each plot. Replace '8' with the number of lines you have.
- set(0,'DefaultAxesColorOrder',linspecer(8))
- set(0,'DefaultAxesColorOrder',cbrewer('qual','Set2',8))
Always increase line thickness to make nicer plots and better perceive color difference.
- set(0,'DefaultLineLineWidth',2)
- set(0,'DefaultLineLineWidth',1.2)
Sources:
The purpose of visualization is to effectively convey information to human viewers. The [jet] color map hinders this task by confusing, obscuring, and actively misleading
![Color Color](https://httpsak-a.akamaihd.net/62009828001/62009828001_5428030095001_3908236623001-vs.jpg?pubId=62009828001&videoId=3908236623001)
'a perceptual disaster'
30 comments