annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/surfplot.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function h = surfplot(varargin)
wolffd@0 2 %SURFPLOT Pseudocolor (checkerboard) plot.
wolffd@0 3 % SURFPLOT(C) is a pseudocolor or "checkerboard" plot of matrix C.
wolffd@0 4 % The values of the elements of C specify the color in each
wolffd@0 5 % cell of the plot. In the default shading mode, 'faceted',
wolffd@0 6 % each cell has a constant color and the last row and column of
wolffd@0 7 % C are not used. With shading('interp'), each cell has color
wolffd@0 8 % resulting from bilinear interpolation of the color at its
wolffd@0 9 % four vertices and all elements of C are used.
wolffd@0 10 % The smallest and largest elements of C are assigned the first and
wolffd@0 11 % last colors given in the color table; colors for the remainder of the
wolffd@0 12 % elements in C are determined by table-lookup within the remainder of
wolffd@0 13 % the color table.
wolffd@0 14 %
wolffd@0 15 % SURFPLOT(X,Y,C), where X and Y are vectors or matrices, makes a
wolffd@0 16 % pseudocolor plot on the grid defined by X and Y. X and Y could
wolffd@0 17 % define the grid for a "disk", for example.
wolffd@0 18 %
wolffd@0 19 % SURFPLOT(AX,..) plots into AX instead of GCA.
wolffd@0 20 %
wolffd@0 21 % H = SURFPLOT(...) returns a handle to a SURFACE object.
wolffd@0 22 %
wolffd@0 23 % SURFPLOT is really a SURF with its view set to directly above.
wolffd@0 24
wolffd@0 25 % SURFPLOT is equivalent to PCOLOR, but slighted corrected for MIRToolbox
wolffd@0 26
wolffd@0 27 %-------------------------------
wolffd@0 28 % Additional details:
wolffd@0 29 %
wolffd@0 30 %
wolffd@0 31 % PCOLOR sets the View property of the SURFACE object to directly
wolffd@0 32 % overhead.
wolffd@0 33 %
wolffd@0 34 % If the NextPlot axis property is REPLACE (HOLD is off), PCOLOR resets
wolffd@0 35 % all axis properties, except Position, to their default values
wolffd@0 36 % and deletes all axis children (line, patch, surf, image, and
wolffd@0 37 % text objects). View is set to [0 90].
wolffd@0 38
wolffd@0 39 % Copyright 1984-2002 The MathWorks, Inc.
wolffd@0 40 % $Revision: 5.9.4.1 $ $Date: 2002/10/24 02:14:11 $
wolffd@0 41
wolffd@0 42 % Slightly corrected for MIRToolbox
wolffd@0 43
wolffd@0 44 % J.N. Little 1-5-92
wolffd@0 45
wolffd@0 46 % Parse possible Axes input
wolffd@0 47 [cax,args,nargs] = axescheck(varargin{:});
wolffd@0 48 error(nargchk(1,4,nargs))
wolffd@0 49
wolffd@0 50 cax = newplot(cax);
wolffd@0 51 hold_state = ishold(cax);
wolffd@0 52
wolffd@0 53 if nargs == 1
wolffd@0 54 x = args{1};
wolffd@0 55 hh = surface(zeros(size(x)),x,'parent',cax);
wolffd@0 56 [m,n] = size(x);
wolffd@0 57 lims = [ 1 n 1 m];
wolffd@0 58 elseif nargs == 3
wolffd@0 59 [x,y,c] = deal(args{1:3});
wolffd@0 60 %cc = zeros(size(y,1),size(x,2));
wolffd@0 61 %cc(1:size(c,1),1:size(c,2)) = c;
wolffd@0 62 hh = surface(x,y,zeros(size(y,1),size(x,2)),c,'parent',cax,'EdgeColor','none'); % Here are the modification
wolffd@0 63 lims = [min(min(x)) max(max(x)) min(min(y)) max(max(y))];
wolffd@0 64 else
wolffd@0 65 error('Must have one or three input data arguments.')
wolffd@0 66 end
wolffd@0 67 if ~hold_state
wolffd@0 68 set(cax,'View',[0 90]);
wolffd@0 69 set(cax,'Box','on');
wolffd@0 70 axis(cax,lims);
wolffd@0 71 end
wolffd@0 72 if nargout == 1
wolffd@0 73 h = hh;
wolffd@0 74 end