wolffd@0: function h = surfplot(varargin) wolffd@0: %SURFPLOT Pseudocolor (checkerboard) plot. wolffd@0: % SURFPLOT(C) is a pseudocolor or "checkerboard" plot of matrix C. wolffd@0: % The values of the elements of C specify the color in each wolffd@0: % cell of the plot. In the default shading mode, 'faceted', wolffd@0: % each cell has a constant color and the last row and column of wolffd@0: % C are not used. With shading('interp'), each cell has color wolffd@0: % resulting from bilinear interpolation of the color at its wolffd@0: % four vertices and all elements of C are used. wolffd@0: % The smallest and largest elements of C are assigned the first and wolffd@0: % last colors given in the color table; colors for the remainder of the wolffd@0: % elements in C are determined by table-lookup within the remainder of wolffd@0: % the color table. wolffd@0: % wolffd@0: % SURFPLOT(X,Y,C), where X and Y are vectors or matrices, makes a wolffd@0: % pseudocolor plot on the grid defined by X and Y. X and Y could wolffd@0: % define the grid for a "disk", for example. wolffd@0: % wolffd@0: % SURFPLOT(AX,..) plots into AX instead of GCA. wolffd@0: % wolffd@0: % H = SURFPLOT(...) returns a handle to a SURFACE object. wolffd@0: % wolffd@0: % SURFPLOT is really a SURF with its view set to directly above. wolffd@0: wolffd@0: % SURFPLOT is equivalent to PCOLOR, but slighted corrected for MIRToolbox wolffd@0: wolffd@0: %------------------------------- wolffd@0: % Additional details: wolffd@0: % wolffd@0: % wolffd@0: % PCOLOR sets the View property of the SURFACE object to directly wolffd@0: % overhead. wolffd@0: % wolffd@0: % If the NextPlot axis property is REPLACE (HOLD is off), PCOLOR resets wolffd@0: % all axis properties, except Position, to their default values wolffd@0: % and deletes all axis children (line, patch, surf, image, and wolffd@0: % text objects). View is set to [0 90]. wolffd@0: wolffd@0: % Copyright 1984-2002 The MathWorks, Inc. wolffd@0: % $Revision: 5.9.4.1 $ $Date: 2002/10/24 02:14:11 $ wolffd@0: wolffd@0: % Slightly corrected for MIRToolbox wolffd@0: wolffd@0: % J.N. Little 1-5-92 wolffd@0: wolffd@0: % Parse possible Axes input wolffd@0: [cax,args,nargs] = axescheck(varargin{:}); wolffd@0: error(nargchk(1,4,nargs)) wolffd@0: wolffd@0: cax = newplot(cax); wolffd@0: hold_state = ishold(cax); wolffd@0: wolffd@0: if nargs == 1 wolffd@0: x = args{1}; wolffd@0: hh = surface(zeros(size(x)),x,'parent',cax); wolffd@0: [m,n] = size(x); wolffd@0: lims = [ 1 n 1 m]; wolffd@0: elseif nargs == 3 wolffd@0: [x,y,c] = deal(args{1:3}); wolffd@0: %cc = zeros(size(y,1),size(x,2)); wolffd@0: %cc(1:size(c,1),1:size(c,2)) = c; wolffd@0: hh = surface(x,y,zeros(size(y,1),size(x,2)),c,'parent',cax,'EdgeColor','none'); % Here are the modification wolffd@0: lims = [min(min(x)) max(max(x)) min(min(y)) max(max(y))]; wolffd@0: else wolffd@0: error('Must have one or three input data arguments.') wolffd@0: end wolffd@0: if ~hold_state wolffd@0: set(cax,'View',[0 90]); wolffd@0: set(cax,'Box','on'); wolffd@0: axis(cax,lims); wolffd@0: end wolffd@0: if nargout == 1 wolffd@0: h = hh; wolffd@0: end