/[MITgcm]/MITgcm/verification/tutorial_global_oce_latlon/diags_matlab/pcol.m
ViewVC logotype

Contents of /MITgcm/verification/tutorial_global_oce_latlon/diags_matlab/pcol.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat Aug 12 19:37:26 2006 UTC (17 years, 8 months ago) by jmc
Branch: MAIN
moved from verification/global_ocean.90x40x15/diags_matlab ;
 add Header and Name; use "quiver" instead of NaNquiver (<- not standard);

1 % Similar to pcolor except that pcol() doesn't drop the last column
2 % or row of data (ie. doesn't interpolated). It uses the shading flat
3 % method by default.
4 %
5 % See also PCOLOR, IMAGESC
6 function [hh] = pcol(varargin);
7
8 % $Header: $
9 % $Name: $
10
11 %cmap=colormap;
12 %if cmap(size(cmap,1),:)==[0 0 0]
13 %else
14 % if sum(sum(isnan(data)))~=0
15 % colormap( [colormap' [0 0 0]']')
16 % end
17 %end
18
19 % Scale data to fit colormap
20 %clim=[min(min(data)) max(max(data))];
21 %data=(data-clim(1))/(clim(2)-clim(1))*(size(colormap,1)-1)+1;
22 %data(find(isnan(data)==1))=size(colormap,1)+1;
23
24 if nargin == 1
25 %hh=imagesc(data);
26 data=varargin{1};
27 pcolor(data([1:end 1],[1:end 1]))
28 % $$$ xtick = get(gca,'XTick')';
29 % $$$ ytick = get(gca,'YTick')';
30 % $$$ xt=xtick+.5;
31 % $$$ yt=ytick+.5;
32 else
33 %hh=imagesc(varargin{1:2},data);
34 x=varargin{1}(:);
35 y=varargin{2}(:);
36 data=varargin{3};
37 pcolor([x' 2*x(end)-x(end-1)],...
38 [y' 2*y(end)-y(end-1)],...
39 data([1:end 1],[1:end 1]))
40 % $$$ dx = diff(x);
41 % $$$ dy = diff(y);
42 % $$$ xtick = get(gca,'XTick'); %[x(1:end-1)+.5*dx; x(end)+.5*dx(end)];
43 % $$$ ytick = get(gca,'YTick'); %[y(1:end-1)+.5*dy; y(end)+.5*dy(end)];
44 % $$$ xt = interp1(x,[x(1:end-1)+.5*dx; x(end)+.5*dx(end)],xtick);
45 % $$$ yt = interp1(y,[y(1:end-1)+.5*dy; y(end)+.5*dy(end)],ytick);
46 end
47 %set(gca,'YDir','normal')
48 % fix tickmarks to emulate imagesc behavior
49 % $$$ dx = diff(x);
50 % $$$ dy = diff(y);
51 % $$$ set(gca,'XTick',xt,'XTickLabel',xtick)
52 % $$$ set(gca,'YTick',yt,'YTickLabel',ytick)
53 set(gca,'Layer','top')
54 shading flat;

  ViewVC Help
Powered by ViewVC 1.1.22