MATLAB: How can i draw a color map from spread sheet in excel? In excel, I have the second attached figure where x=wave length,y=Abs., and legend = doping conc. I want to draw them like the attached color map. attached image from excel shows the data

colormapexcelmatrix manipulation

<<pic>>

Best Answer

This code will make that red, white, and blue patriotic colormap:
numColors = 256;
ramp = linspace(0, 1, numColors/2)';
rampFlipped = linspace(1, 0, numColors/2)';
flat = ones(numColors/2, 1);
redColorMap = [flat; rampFlipped];
greenColorMap = [ramp; rampFlipped];
blueColorMap = [ramp; flat];
blueRedColorMap = [redColorMap, greenColorMap, blueColorMap];
colorbar();
colormap(blueRedColorMap);
Related Question