Mathematica中文论坛-非官方

标题: 豆粑粑 matlab colormap cold [打印本页]

作者: meatball1982    时间: 2017-12-25 10:33
标题: 豆粑粑 matlab colormap cold
Normally,  i perfer the "hot" colormap to illustrate the "heavy" -> "light" color.But with diff propeties of  the 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/matlabc ... 23865-cold-colormap

The same thought as I got.



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

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

  26. r = [zeros(2*n,1); (1:m-2*n)'/(m-2*n)];
  27. g = [zeros(n,1); (1:n)'/n; ones(m-2*n,1)];
  28. b = [(1:n)'/n; ones(m-n,1)];

  29. cmap = [r g b];
复制代码







欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/) Powered by Discuz! X3.2