Back to home page

MITgcm

 
 

    


Warning, /verification/tutorial_global_oce_latlon/diags_matlab/pcol.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
051ee7f715 Jean*0001 % Similar to pcolor except that pcol() doesn't drop the last column
                0002 % or row of data (ie. doesn't interpolated). It uses the shading flat
                0003 % method by default.
                0004 %
                0005 % See also  PCOLOR, IMAGESC
                0006 function [hh] = pcol(varargin);
                0007 
                0008 %cmap=colormap;
                0009 %if cmap(size(cmap,1),:)==[0 0 0]
                0010 %else
                0011 % if sum(sum(isnan(data)))~=0
                0012 %  colormap( [colormap' [0 0 0]']')
                0013 % end
                0014 %end
                0015 
                0016 % Scale data to fit colormap
                0017 %clim=[min(min(data)) max(max(data))];
                0018 %data=(data-clim(1))/(clim(2)-clim(1))*(size(colormap,1)-1)+1;
                0019 %data(find(isnan(data)==1))=size(colormap,1)+1;
                0020 
                0021 if nargin == 1
                0022 %hh=imagesc(data);
                0023  data=varargin{1};
                0024  pcolor(data([1:end 1],[1:end 1]))
                0025 % $$$  xtick = get(gca,'XTick')';
                0026 % $$$  ytick = get(gca,'YTick')';
                0027 % $$$  xt=xtick+.5;
                0028 % $$$  yt=ytick+.5;
                0029 else
                0030 %hh=imagesc(varargin{1:2},data);
                0031  x=varargin{1}(:);
                0032  y=varargin{2}(:);
                0033  data=varargin{3};
                0034  pcolor([x' 2*x(end)-x(end-1)],...
                0035         [y' 2*y(end)-y(end-1)],...
                0036         data([1:end 1],[1:end 1]))
                0037 % $$$  dx = diff(x);
                0038 % $$$  dy = diff(y);
                0039 % $$$  xtick = get(gca,'XTick'); %[x(1:end-1)+.5*dx; x(end)+.5*dx(end)];
                0040 % $$$  ytick = get(gca,'YTick'); %[y(1:end-1)+.5*dy; y(end)+.5*dy(end)];
                0041 % $$$  xt = interp1(x,[x(1:end-1)+.5*dx; x(end)+.5*dx(end)],xtick);
                0042 % $$$  yt = interp1(y,[y(1:end-1)+.5*dy; y(end)+.5*dy(end)],ytick);
                0043 end
                0044 %set(gca,'YDir','normal')
                0045 % fix tickmarks to emulate imagesc behavior
                0046 % $$$ dx = diff(x);
                0047 % $$$ dy = diff(y);
                0048 % $$$ set(gca,'XTick',xt,'XTickLabel',xtick)
                0049 % $$$ set(gca,'YTick',yt,'YTickLabel',ytick)
                0050 set(gca,'Layer','top')
                0051 shading flat;