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

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