Z = sst_up_574;
X = Y1;
Y = Ydepth;
x = nan(size(X,1))
y = nan(size(Y,1))
for j = 1:size(Z,1)
[~,c] = find(~isnan(Z(j,:))==true,1,'first');
if ~isempty(c)
x(j) = X(j,c);
y(j) = Y(j,c);
else
x(j) = max(X(j,:));
y(j) = max(Y(j,:));
end
end
x(isnan(x))=[];
y(isnan(y))=[];
x = [x 0];
y = [y min(Y(:))]
in = inpolygon(X(:),Y(:),x,y);
Zq = fillmissing(Z,'linear',2);
Zq(~in) = NaN;
figure(1)
pcolor(X,Y,Zq); shading flat
set(gca,'Ydir','reverse')
set(gca,'xlim',[bin(1) bin(91)],...
'ylim',[0 500],'fontsize',8,'xminortick','on','yminortick','on')
hold on
hc = colorbar;
rmap=jet(20);
newmap=rmap(2:1:20,:);
colormap(newmap);
caxis([4 23]);
grid on;
box on
set(gca,'Fontweight','bold','Fontsize',16);
set(get(hc,'ylabel'),'string','Water Temperature (^oC)','rotation',270,'verticalalignment','bottom');
ylabel('Depth (m)');
xlabel('Date');
title(['Water Temperature: Upstream SG574'], 'fontweight', 'bold','FontSize',18)
Best Answer