File Exchange

## Red Blue Colormap

version 1.0 (1.47 KB) by

A colormap from bright blue, through white, and then to bright red.

4.875
8 Ratings

Updated

REDBLUE(M), is an M-by-3 matrix that defines a colormap.
The colors begin with bright blue, range through shades of blue to white, and then through shades of red to bright red. REDBLUE, by itself, is the same length as the current figure's colormap.

Richard Fightmaster

### Richard Fightmaster (view profile)

I typed in "redblue" and it seemed to work but nothing came up in the "figure 1".

Paméla Didier

### Paméla Didier (view profile)

I am sorry, I am not a pro of Matlab. Can you explain how to use this function?

nathan q

### nathan q (view profile)

Babette Christelle Tchonang

### Babette Christelle Tchonang (view profile)

thanks a lot for the this range of colorbar

Yu-Lin Tsai

### Yu-Lin Tsai (view profile)

Very useful and helpful to my figure! Thanks!

Gery Mandala

Liaofan Lin

Great!

EsniX

### EsniX (view profile)

great colormap

Stephen Cobeldick

### Stephen Cobeldick (view profile)

@Rob Campbell: a good idea, but that code give the wrong length output if |m| is odd. Here is one possible fix:

n = fix(m/2);
x = n~=(m/2);
r = [(0:1:n-1)/n,ones(1,n+x)];
g = [(0:1:n-1)/n,ones(1,x),(n-1:-1:0)/n];
b = [ones(1,n+x),(n-1:-1:0)/n];
c = [r(:),g(:),b(:)];

Felipe Orellana

### Felipe Orellana (view profile)

Thanks a lot dude. I appreciate your effort.

thank you very much,

Felipe

chsharrison

### chsharrison (view profile)

Just what I was looking for

Mathias Vanwolleghem

Rob Campbell

### Rob Campbell (view profile)

Thankyou: nice colormap. What do you think of this? A neater way to obtain c:

n = fix(0.5*m);
r = [(0:1:n-1)/n,ones(1,n)];
g = [(0:n-1)/n, (n-1:-1:0)/n];
b = [ones(1,n),(n-1:-1:0)/n];
c = [r(:), g(:), b(:)];

Xianmin

### Xianmin (view profile)

The function "colormapeditor" from MATLAB will be helpful to customizer the colormap

##### MATLAB Release
MATLAB 7.7 (R2008b)