meatball1982 发表于 2017-12-25 10:33:37

豆粑粑 matlab colormap cold

Normally,i perfer the "hot" colormap to illustrate the "heavy" -> "light" color.But with diff propeties ofthe total opposite value, Such as ,the pops and popc denisty.
I need a color map as the opposite of "hot". Ha, I use the name "cold".
Great minds think alike.
I got the "cold " colormap on File Exchange.
https://cn.mathworks.com/matlabcentral/fileexchange/23865-cold-colormap

The same thought as I got.



function cmap = cold(m)
%COLD    Black-Blue-Cyan-White Color Map
%   COLD(M) returns an M-by-3 matrix containing a "cold" colormap
%   COLD, by itself, is the same length as the current figure's
%   colormap. If no figure exists, MATLAB creates one.
%
%   Example:
%       imagesc(peaks(500))
%       colormap(cold); colorbar
%
%   Example:
%       load topo
%       imagesc(0:360,-90:90,topo), axis xy
%       colormap(cold); colorbar
%
% See also: hot, cool, jet, hsv, gray, copper, bone, vivid
%
% Author: Joseph Kirk
% Email: jdkirk630@gmail.com
% Release: 1.0
% Date: 04/21/09

if nargin < 1
    m = size(get(gcf,'colormap'),1);
end
n = fix(3/8*m);

r = ;
g = ;
b = [(1:n)'/n; ones(m-n,1)];

cmap = ;

页: [1]
查看完整版本: 豆粑粑 matlab colormap cold