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

  1. function h = pcolor(x,y,c)
  2. %PCOLOR    Pseudocolor (checkerboard) plot.
  3. %    PCOLOR(C) is a pseudocolor plot of matrix C.  The screen is broken
  4. %    into a rectangular "checkerboard" the same size as C.  The value of
  5. %    each element of C specifies the color in its corresponding rectangle.
  6. %    The smallest and largest elements of C are assigned the first and
  7. %    last colors given in the color table; colors for the remainder of the 
  8. %    elements in C are determined by table-lookup within the remainder of 
  9. %    the color table.
  10. %    PCOLOR(X,Y,C), where X and Y are vectors or matrices, makes a
  11. %    pseudocolor plot on the grid defined by X and Y.  X and Y could 
  12. %    define the grid for a "disk", for example.
  13. %    PCOLOR is really a SURF with its view set to directly above.
  14. %    PCOLOR returns a handle to a SURFACE object.
  15. %
  16. %    See also CAXIS, SURF, MESH, IMAGE.
  17.  
  18. %-------------------------------
  19. %    Additional details:
  20. %
  21. %
  22. %    PCOLOR sets the View property of the SURFACE object to directly 
  23. %    overhead.
  24. %
  25. %    If the NextPlot axis property is REPLACE (HOLD is off), PCOLOR resets 
  26. %    all axis properties, except Position, to their default values
  27. %    and deletes all axis children (line, patch, surf, image, and 
  28. %    text objects).  View is set to [0 90].
  29.  
  30. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  31.  
  32. %    J.N. Little 1-5-92
  33.  
  34. if nargin < 1
  35.     error('Too few input arguments.');
  36. elseif nargin > 4
  37.     error('Too many input arguments.')
  38. end
  39.  
  40. cax = newplot;
  41. next = lower(get(cax,'NextPlot'));
  42. hold_state = ishold;
  43.  
  44. if nargin == 1
  45.     hh = surface(zeros(size(x)),x);
  46.     [m,n] = size(x);
  47.     lims = [ 1 n 1 m];
  48. elseif nargin == 3
  49.     hh = surface(x,y,zeros(size(c)),c);
  50.     lims = [min(min(x)) max(max(x)) min(min(y)) max(max(y))];
  51. else
  52.     error('Must have one or three input arguments.')
  53. end
  54. if ~hold_state
  55.     set(cax,'View',[0 90]);
  56.     set(cax,'Box','on');
  57.     axis(lims);
  58. end
  59. if nargout == 1
  60.     h = hh;
  61. end
  62.