Colormap engineering to highlight small values
Show older comments
I would like to construct a colormap for a set of data where the values range from [0,100] but I want the values in the [0,20] range to be more noticeable as they get to zero. Ideally lightness would be similar across the range but chroma would increase sharply toward zero so you could see the differences in the [0,20] range. Here is what I tried so far, but the decreased lightness toward zero makes it hard to see. Any suggestions? It seems like having color relate on a log not linear scale to the values might help.
figure;
% Make fake dataset
z = peaks;
z = z - min(z(:)); % Make 0 the smallest value
z = z*100/max(z(:)); % Make 100 the largest value
[nRow, nCol] = size(z);
surf(1:nRow, 1:nCol, z); % Make a color-coded 3D plot
colormap(flipud(copper)); % Colormap that should highlight the lowest values
1 Comment
Adam
on 2 Nov 2018
If you want to highlight small subsets of the range you may want to specify a larger colourmap size, in addition to choosing a custom colourmap as Stephen suggests below, to ensure there are enough actual colours on the map to give the variation within only 20% of the full range. It may be that ~51 as you would get by default with a size 256 colourmap is enough, but it may not with a colourmap specifically designed for this purpose.
Accepted Answer
More Answers (1)
You will need to either:
- scale the values before plotting (e.g. log/exp), or
- create/find a suitable colormap that highlights that region.
Personally I would start with the second option: changing data in order to plot it rather a hack job. My Cubehelix colormap generator might let you create a colormap that suit your needs:
Otherwise see if you can find a nice colormap that does what you want:
Categories
Find more on White in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!