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