File Exchange

image thumbnail

Red Blue Colormap

version (1.47 KB) by Adam Auton
A colormap from bright blue, through white, and then to bright red.


Updated 09 Oct 2009

View License

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.

Cite As

Adam Auton (2021). Red Blue Colormap (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (44)

Hanwen Zhang

Great colormap! Thank you!

Amgad Abdrabou

Siddharth Rawat

Looks pretty cool!

Samuel Cortinhas

gao yang

Thank you! That's what I want!

Wenhui Qiao

very pretty colormap! I like it!

Baoqing Lu

Very nice function. Thank you very much! I like your choice of colors, which makes the contrast more conspicuous and thus the figures more readable.

A King


Daniele Certini


matt majic

Lindsay Sheridan

Kevin Bryant

Xb Zzzh

great function~ It really helps

anasuya barik

Elizabeth Wraback

Nikita Sandaliuk

Michael Jones

Anna Titova


Ryo Pratama

Avishek Paul


Shengyan Liu

Wei-Heng Hsu


Shane L



Mathew Owens

For those asking questions, simply put the .m file in a directory in your Matlab path, then run


before your plotting routine.

Richard Fightmaster

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

Paméla Didier

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

nathan q

thanks a lot for the this range of colorbar

Yu-Lin Tsai

Very useful and helpful to my figure! Thanks!

Gery Mandala

Liaofan Lin



great colormap

Stephen Cobeldick

@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

Hi Adam,

I downloaded your redblue colormap. It's nice.

Thanks a lot dude. I appreciate your effort.

thank you very much,



Just what I was looking for

Mathias Vanwolleghem

Rob Campbell

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(:)];


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

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!