Home > omviz > pslice2.m

pslice2

PURPOSE ^

PSLICE2 Just like pslice, but no color legend bar is drawn

SYNOPSIS ^

function h=pslice2(x,y,u,cax)

DESCRIPTION ^

 PSLICE2  Just like pslice, but no color legend bar is drawn
  USAGE: pslice2(x,y,u,cax)
 x is array of x points
 y is array of y points 
 u is array of data
 cax is range of data to map  (autoscales if not supplied)

 EXAMPLE:  pslice(x,y,temp,[10 22],'Temperature')  
                Plots the variable temp from 10 to 22 deg, and labels the
                colorbar legend as "Temperature (C)"

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function h=pslice2(x,y,u,cax)
0002 % PSLICE2  Just like pslice, but no color legend bar is drawn
0003 %  USAGE: pslice2(x,y,u,cax)
0004 % x is array of x points
0005 % y is array of y points
0006 % u is array of data
0007 % cax is range of data to map  (autoscales if not supplied)
0008 %
0009 % EXAMPLE:  pslice(x,y,temp,[10 22],'Temperature')
0010 %                Plots the variable temp from 10 to 22 deg, and labels the
0011 %                colorbar legend as "Temperature (C)"
0012 %
0013 
0014 % Rich Signell
0015 % rsignell@usgs.gov
0016 
0017 ind=find(~isnan(u));
0018 if(nargin<4),
0019  cax(1)=min(u(ind));
0020  cax(2)=max(u(ind));
0021 
0022  if(cax(2)==cax(1))
0023      cax(1) = cax(1)-0.01;
0024      cax(2) = cax(2)+0.01;
0025  end
0026 
0027 
0028 else
0029  if(isnan(cax(1))),cax(1)=min(u(ind));end;
0030  if(isnan(cax(2))),cax(2)=max(u(ind));end;
0031 end
0032 u(ind)=max(u(ind),cax(1));
0033 u(ind)=min(u(ind),cax(2));
0034 [m,n]=size(x);
0035 if(min(m,n)>1),
0036   x=.25*(x(1:m-1,1:n-1)+x(2:m,1:n-1)+x(1:m-1,2:n)+x(2:m,2:n));
0037   y=.25*(y(1:m-1,1:n-1)+y(2:m,1:n-1)+y(1:m-1,2:n)+y(2:m,2:n));
0038   u(1,:)=[];
0039   u(:,1)=[];
0040 end
0041 h=pcolor(x,y,u);
0042 colormap('jet');...
0043 shading('flat');
0044 caxis(cax);
0045 
0046 matlab_version = version;
0047 if ( matlab_version(1) == '5' )
0048     set ( gca, 'DataAspectRatio', [1 1 1] );
0049 else
0050     set(gca,'aspectratio',[NaN 1])
0051 end

Generated on Thu 01-Dec-2005 08:50:35 by m2html © 2003