Home > General-Functions > Graphics > plot_surface.m

plot_surface

PURPOSE ^

% Ploting 2.5D surfaces

SYNOPSIS ^

function h = plot_surface(ds,BB,delta_x,varargin)

DESCRIPTION ^

% Ploting 2.5D surfaces

 Usage:
    plot_surface(ds,BB,delta_x)
    h = plot_surface(ds,BB,delta_x, [varargin])
 
 ds: double NxM, grid containing surface to plot
 BB: double 1x4 Bounding Box of surface footprint
     [xmin, ymin, xmax, ymax]
 delta_x: double, grid size
 varagin: key-value pairs according to matlabs plot parameters

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Ploting 2.5D surfaces
0002 %
0003 % Usage:
0004 %    plot_surface(ds,BB,delta_x)
0005 %    h = plot_surface(ds,BB,delta_x, [varargin])
0006 %
0007 % ds: double NxM, grid containing surface to plot
0008 % BB: double 1x4 Bounding Box of surface footprint
0009 %     [xmin, ymin, xmax, ymax]
0010 % delta_x: double, grid size
0011 % varagin: key-value pairs according to matlabs plot parameters
0012 %
0013 
0014 function h = plot_surface(ds,BB,delta_x,varargin)
0015 
0016 args = plot_surfaceArgs(varargin{:});
0017 
0018 Nr = size(ds,1); Mc = size(ds,2);
0019 
0020 X = ([0:Nr-1]'*ones(1,Mc))*delta_x+BB(1);                                   %#ok<*NBRAK>
0021 Y = (ones(Nr,1)*[0:Mc-1])*delta_x+BB(2);
0022 
0023 colormap(args.colormap)
0024 
0025 switch args.ColorFct
0026     case 'smoothtanh'    
0027         shade = -[ 0 -1; 1 0]/sqrt(2);
0028         col=conv2(ds,shade,'same');
0029         %col=(1+col./sqrt(1+col.^2))/2;
0030         colo=min(1, max(0,tanh(100*(col-0)/(max(col(:))-min(col(:))))));
0031 
0032         h = args.plotfun(X,Y,ds,colo);
0033     case 'none'
0034         h = args.plotfun(X,Y,ds);
0035 end
0036 set(h,'FaceLighting',args.FaceLighting,'EdgeColor',args.EdgeColor)
0037 set(gca,'XGrid',args.Grid)
0038 set(gca,'YGrid',args.Grid)
0039 set(gca,'ZGrid',args.Grid)
0040     
0041 alpha(args.alpha);
0042 if ~strcmp(args.shading,'none')
0043     shading(args.shading);
0044 end
0045 view(args.view);

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005