| 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 |
%cmap=colormap; |
| 9 |
%if cmap(size(cmap,1),:)==[0 0 0] |
| 10 |
%else |
| 11 |
% if sum(sum(isnan(data)))~=0 |
| 12 |
% colormap( [colormap' [0 0 0]']') |
| 13 |
% end |
| 14 |
%end |
| 15 |
|
| 16 |
% Scale data to fit colormap |
| 17 |
%clim=[min(min(data)) max(max(data))]; |
| 18 |
%data=(data-clim(1))/(clim(2)-clim(1))*(size(colormap,1)-1)+1; |
| 19 |
%data(find(isnan(data)==1))=size(colormap,1)+1; |
| 20 |
|
| 21 |
if nargin == 1 |
| 22 |
%hh=imagesc(data); |
| 23 |
data=varargin{1}; |
| 24 |
pcolor(data([1:end 1],[1:end 1])) |
| 25 |
else |
| 26 |
%hh=imagesc(varargin{1:2},data); |
| 27 |
x=varargin{1};x=x(:); |
| 28 |
y=varargin{2};y=y(:); |
| 29 |
data=varargin{3}; |
| 30 |
pcolor([x' 2*x(end)-x(end-1)],... |
| 31 |
[y' 2*y(end)-y(end-1)],... |
| 32 |
data([1:end 1],[1:end 1])) |
| 33 |
end |
| 34 |
%set(gca,'YDir','normal') |
| 35 |
shading flat; |