Who am I

我的照片
Hefei, Anhui, China
Research Fields: Satellite Geodesy

2013年5月30日星期四

自定义colormap meep (zt)

matlab 自定义colormap meep (from red through white to blue)

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

参考资料:
http://meyavuz.blogspot.de/2011/02/meep-colormap-for-matlab.html

没有评论:

发表评论