File Exchange

image thumbnail

darkb2r(cmin_input,​cmax_input)

version 1.1.0.0 (4.75 KB) by cunjie zhang
matlab blue-white-red colorbar, while zero always corresponds to white color. see also b2r

4 Downloads

Updated 09 Apr 2015

View License

this matlab file is designed to draw anomaly figures, the color of the colorbar is from blue to white and then to red, corresponding to the anomaly values from negative to zero to positive, respectively.
The color white always correspondes to value zero.

You should input two values like caxis in matlab, that is the min and the max value of color values designed. e.g. colormap(darkb2r(-3,5))

The brightness of blue and red will change according to your setting, so that the brightness of the color corresponded to the color of his opposite number
e.g. colormap(darkb2r(-3,6)) is from light blue to deep red
e.g. colormap(darkb2r(-3,3)) is from deep blue to deep red
I'd advise you to use colorbar first to make sure the caxis' cmax and cmin
Examples:
------------------------------
figure
peaks;
colormap(darkb2r(-6,8)), colorbar, title('darkb2r')

There is also a similar colorbar named b2r with colors much lighter.

Comments and Ratings (2)

Aodat

running darkb2r creates empty figure, is it possible to avoid figure creation?

Updates

1.1.0.0

updated: Robert Beckman help to fix the bug when start point is zero, 2015-04-08. The bug exist when the absolute value of cmax and cmin is very near but not equal.

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux