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

  1. function [cmin, cmax] = caxis(arg)
  2. %CAXIS    Pseudocolor axis scaling.
  3. %    CAXIS(V), where V is the two element vector [cmin cmax], sets manual
  4. %    scaling of pseudocolor for the SURFACE and PATCH objects created by
  5. %    commands like MESH, PCOLOR, and SURF.  cmin and cmax are assigned
  6. %    to the first and last colors in the current colormap.  Colors for PCOLOR
  7. %    and SURF are determined by table lookup within this range.  Values
  8. %    outside the range are clipped by making them transparent.
  9. %    CAXIS('auto') sets axis scaling back to autoranging.
  10. %    CAXIS, by itself, returns the two element row vector containing the
  11. %    [cmin cmax] currently in effect.
  12. %
  13. %    CAXIS is an M-file that sets the axes properties CLim and CLimMode.
  14. %
  15. %    See also COLORMAP, AXES, AXIS.
  16.  
  17. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  18.  
  19. ax = gca;
  20.  
  21. if(nargin == 0)
  22.     cmin = get(ax,'CLim');
  23.     if(nargout == 2)
  24.         cmax = cmin(2); cmin = cmin(1);
  25.     end
  26. else
  27.     if(isstr(arg))
  28.         if(strcmp(arg, 'auto'))
  29.             set(ax,'CLimMode','auto');
  30.         else
  31.             error('Unknown command option')
  32.         end
  33.     else
  34.         [r c] = size(arg);
  35.         if(r * c == 2)
  36.             set(ax,'CLim',arg);
  37.         else
  38.             error('Must be two element row vector.')
  39.         end
  40.     end
  41. end
  42.