home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / COLOR.DI$ / FLAG.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  791 b   |  26 lines

  1. function map = flag(m)
  2. %FLAG    Alternating red, white, blue, and black color map.
  3. %    FLAG(M) returns an M-by-3 matrix containing a "flag" colormap.
  4. %    Increasing M increases the granularity emphasized by the map.
  5. %    FLAG, by itself, is the same length as the current colormap.
  6. %
  7. %    For example, to reset the colormap of the current figure:
  8. %
  9. %              colormap(flag)
  10. %
  11. %    See also HSV, GRAY, HOT, COOL, COPPER, PINK, BONE, 
  12. %    COLORMAP, RGBPLOT.
  13.  
  14. %    C. Moler, 7-4-91, 8-19-92.
  15. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  16.  
  17. if nargin < 1, m = size(get(gcf,'colormap'),1); end
  18.  
  19. % f = [red; white; blue; black]
  20. f = [1 0 0; 1 1 1; 0 0 1; 0 0 0];
  21.  
  22. % Generate m/4 vertically stacked copies of f with Kronecker product.
  23. e = ones(ceil(m/4),1);
  24. map = kron(e,f);
  25. map = map(1:m,:);
  26.