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

  1. function map = hsv(m)
  2. %HSV    Hue-saturation-value (HSV) color map.
  3. %    HSV(M) returns an M-by-3 matrix containing an HSV colormap.
  4. %    HSV, by itself, is the same length as the current colormap.
  5. %
  6. %    An HSV colormap varies the hue component of the hue-saturation-value
  7. %    color model.  The colors begin with red, pass through yellow, green,
  8. %    cyan, blue, magenta, and return to red.  The map is particularly
  9. %    useful for displaying periodic functions.  
  10. %
  11. %    For example, to reset the colormap of the current figure:
  12. %
  13. %              colormap(hsv)
  14. %
  15. %    See also GRAY, HOT, COOL, BONE, COPPER, PINK, FLAG, PRISM, JET,
  16. %    COLORMAP, RGBPLOT, HSV2RGB, RGB2HSV.
  17.  
  18. %    See Alvy Ray Smith, Color Gamut Transform Pairs, SIGGRAPH '78.
  19. %    C. B. Moler, 8-17-86, 5-10-91, 8-19-92, 2-19-93.
  20. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  21.  
  22. if nargin < 1, m = size(get(gcf,'colormap'),1); end
  23. h = (0:m-1)'/max(m,1);
  24. map = hsv2rgb([h ones(m,2)]);
  25.