Thursday, February 24, 2011

MEEP colormap for Matlab

I have been thinking of using the colormap used in the MEEP software (an open source FDTD code) as a nice alternative to the classical Matlab colormap. Here is the short Matlab code to generate it and the resulting images:

mincolor    = [1 0 0]; % red
mediancolor = [1 1 1]; % white   
maxcolor    = [0 0 1]; % blue      

ColorMapSize = 4;
int1 = zeros(ColorMapSize,3); 
int2 = zeros(ColorMapSize,3);
for k=1:3
    int1(:,k) = linspace(mincolor(k), mediancolor(k), ColorMapSize);
    int2(:,k) = linspace(mediancolor(k), maxcolor(k), ColorMapSize);
end
meep = [int1(1:end-1,:); int2];

colormap(meep); 
colorbar
Classical Matlab colormap (jet)
MEEP colormap with ColorMapSize 64
MEEP colormap with ColorMapSize 16
MEEP colormap with ColorMapSize 4

*Images are snapshots from the FDTD simulation of a dish antenna.

1 comment: