A symmetric colourmap, with neutral central color, diverging either side to warm colors for positive values, and cold colours for negative ones. This is useful for data where the sign is important, e.g. expansion/contraction in fluid visualisation. This map should allow slightly better distinction of different values within the hot or cold partitions, compared to a map with only two colours (like red-grey-green
The neutral gray-level is user-definable, and the order of the light/dark colors either side automatically switches to match light or dark gray in the centre.
There is also an option to produce a colormap with a linear intensity/luminance variation when results are converted to grayscale. This requires the neutral gray-level to be 0.5.
Ged Ridgway (2021). Bipolar Colormap (https://www.mathworks.com/matlabcentral/fileexchange/26026-bipolar-colormap), MATLAB Central File Exchange. Retrieved .
I'd also take a look at:
Dear Oliver, thank you very much for your feedback.
Regarding the flipping, bipolar takes an optional second argument which specifies the gray-level value of the neutral color, and the ends are actually automatically flipped around if you specify a whiter shade of pale gray. E.g. if you specify 1, you get blue-cyan-white-yellow-red. Personally, I don't think this looks as nice, but that is of course subjective.
Regarding your other colormaps, I'm afraid I personally find the same perceptual issue with "bright" (purple bands above and below the pure blue) and with "pastel" (to a small extent but in several places).
I really like your thermal and temp colormaps, however, I am particularly keen on having a neutral mid-gray in the centre of the map (which was the reason I focused on hicontrast), rather than white (as in temp) or red (as in thermal).
I will play around with modifying CMRmap, thermal and temp, to see if I can find something I am really happy with... If you have any further suggestions, they would be much appreciated, thanks!
Ged, real2rgb (id 23342) only linearizes a colormap's absolute gradient in luminance per color entry - they need to be monotonic to start with if you want monotonic output. It has several other monotonic colormaps (which can be linearized) other than hicontrast. Perhaps you'll find one you like.
My thoughts on this colormap are that it could look better with the two ends flipped so that they converge on white instead of dark gray. Have you tried it?
Dear "us", thank you for your suggestion! I'll make your modification in a future update.
Dear Sjoerd, thank you very much for drawing my attention to Carey Rappaport's CMRmap. It turns out that my colormap is not currently suitable for conversion to grayscale.
To some extent, it's actually rather difficult to get good visualisation of bipolar/signed data in grayscale anyway, but it would be nice to have a map that degraded more gracefully. I tried to find a bit more about the theory, but have so far failed. E.g. this site is otherwise very helpful,
but says "Differences in lightness should be preserved with sequential schemes" while "diverging schemes cannot be photocopied successfully." In other words, Dr Brewer doesn't attempt to make bipolar schemes with nice grayscale equivalents.
I found ID 23342 from a comment on CMRmap, and have just tried it out. Unfortunately, its conversion of my colormap to a linear-gray version doesn't seem to work well; the result is non-monotonic in gray-level (at least when converted from a saved PNG using the Gimp) and additionally translates the neutral gray away from the origin. ID 23342 also has a colormap called hicontrast, with linear grayscale, but I don't really like this, as it seems perceptually non-monotonic in color to me, e.g. either side of cyan you can see a pair of pale green colors, which are (by construction) separated in gray-level, but not really in hue, similarly either side of red is a pair of similar magenta hues.
I will try to look into this in more detail and provide an alternative map (necessarily without the user-definable neautral gray-level, as this will have to be at or very near to 0.5) that degrades better to grayscale in a future update... Thanks again for the heads-up!
Have a look at the CMR map http://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m
How does your colormap perform in grayscale? Is it monotonically increasing as well?
very nice colormap engine including good help and comments...
one of the (minor) short-comings:
it unnecessarily opens a figure (which is tediously true for ML's COLORMAP as well) if called without an open figure...
the following code prevents this from happening and could be inserted easily
if ~exist('m','var') || isempty(m)
just a thought
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!