How to fill a Temperature Transect Plot?

How can I use my bathymetry as a limit for my pcolor temperature plot? To fill the blanks.
Or, fill the whole plot and use the bathymetry with 'area' to mask?
%x = x.' % invert axis
%new life
clear;
close all;
clc;
%Summon data
data = xlsread('pernada1.xls');
%Create all vectors with the same size
%depth in each point
d1 = data(:,1);
d2 = data(:,3);
d3 = data(:,5);
d4 = data(:,7);
d5 = data(:,9);
dall = [d1;d2;d3;d4;d5];
%temp in each point
t1 = data(:,2);
t2 = data(:,4);
t3 = data(:,6);
t4 = data(:,8);
t5 = data(:,10);
tall = [t1;t2;t3;t4;t5];
%Aternative to fill the bottom of that matrix with NaN values
Nmax = max([length(d1),length(d2),length(d3),length(d4),length(d5)]);
E = 5; % number of stations
T = NaN( Nmax , E ); % create a matrix filled with NaN values
T( 1:length(t1) , 1) = t1; % fill in the first column of the matrix with t1
T( 1:length(t2) , 2) = t2; % fill in the second column of the matrix with t2
T( 1:length(t3) , 3) = t3; % fill in the second column of the matrix with t3
T( 1:length(t4) , 4) = t4; % fill in the second column of the matrix with t4
T( 1:length(t5) , 5) = t5; % fill in the second column of the matrix with t5
%Distribution of functions in the plot
x = 200:400:2000; % Define x vector of station locations
z = d4; % Define z vector of max depths
%z = d4; % Define z vector of max depths
figure; % Create new figure window
pcolor(x,z,T); % Create plot of temperature
colorbar;
hcb=colorbar;
title(hcb,'Temperature');
%contourf(x,z,T,'ShowText','on'); %countourf with labels
shading interp; % Remove visible mesh and set colours to be interpolated
set(gca,'ydir','reverse'); % Flip the direction of the y-axis
% Setting axis
xlim([0,2000]);
ylim([0,30]);
hold on
%Bathymetry with 127 values
%bathymetry = [0 0.4 0.8 1.01 1.33 1.66 1.80 2.33 2.83 2.98 3.02 3.15 3.29 3.53 3.83 4.53 4.67 4.99 5.83 6.37 7.44 8.53 9.79 9.82 9.97 10.22 10.86 11.62 12.48 12.87 13.92 14.29 14.72 15.57 15.92 16.16 16.88 17.10 17.67 18.08 18.45 19.22 19.72 20.09 20.62 21.3 21.42 21.97 22.42 22.94 23.11 23.34 23.8 24.02 24.21 24.53 24.86 25.01 25.12 25.28 25.53 25.74 25.99 26.11 26.27 26.36 26.45 26.57 26.61 26.72 26.91 26.61 27.02 27.08 27.11 27.18 26.78 26.18 25.75 25.11 24.76 24.48 24.33 24.29 24.12 24.08 23.99 23.87 23.72 23.66 23.59 23.27 23.08 23.01 22.9 22.42 22.14 21.87 18.79 17.55 16.79 15.92 15.21 14.09 13.45 12.09 11.77 10.89 10.57 10.34 10.29 10.17 9.94 9.79 8.62 7.29 6.78 5.67 4.79 3.98 2.79 2.11 1.25 0.4 0.2 0.1 0];
%bathymetry = bathymetry.'
%plot(x, bathymetry)
%Transect with 150 values
%transect = [1:13.33:2000];
%Transect with 127 values
transect = [1:15.748:2000];
%Bathymetry with 150 values
%bathymetry = [0 0.4 0.8 1.01 1.33 1.66 1.80 2.33 2.53 2.83 2.98 3.02 3.15 3.29 3.53 3.83 4.53 4.67 4.99 5.53 5.83 6.37 7.44 8.53 9.73 9.79 9.82 9.97 10.02 10.22 10.86 11.62 11.92 12.48 12.87 13.92 14.29 14.38 14.72 15.57 15.92 16.02 16.16 16.88 17.10 17.32 17.67 18.08 18.45 18.86 19.22 19.72 20.09 20.62 20.88 21.3 21.42 21.65 21.97 22.2 22.42 22.94 23.11 23.34 23.8 24.02 24.21 24.53 24.86 25.01 25.12 25.28 25.53 25.74 25.99 26.11 26.27 26.36 26.45 26.57 26.61 26.72 26.91 26.61 27.02 27.08 27.11 27.18 26.78 26.54 26.18 25.75 25.11 24.76 24.56 24.48 24.33 24.29 24.17 24.12 24.08 23.99 23.87 23.72 23.66 23.59 23.39 23.27 23.08 23.01 22.9 22.42 22.14 21.87 20.4 18.79 17.55 16.79 15.92 15.21 14.09 13.45 12.09 11.77 11.01 10.89 10.57 10.34 10.29 10.17 9.94 9.79 8.62 7.29 6.78 5.67 4.79 3.98 2.79 2.11 1.25 0.4 0.3 0.2 0.1 0.1 0 0 0 0];
%Bathymetry with 127 values
bathymetry = [0 0.4 0.8 1.01 1.33 1.66 1.80 2.33 2.53 2.83 2.98 3.02 3.15 3.29 3.53 3.83 4.53 4.67 4.99 5.83 6.37 7.44 8.53 9.73 9.79 9.82 9.97 10.02 10.22 10.86 11.62 11.92 12.87 13.92 14.29 14.72 15.57 15.92 16.02 16.16 16.88 17.10 17.32 17.67 18.08 18.45 18.86 19.22 19.72 20.09 20.62 20.88 21.3 21.42 21.65 21.97 22.2 22.42 22.94 23.11 23.34 23.8 24.02 24.21 24.53 24.86 25.01 25.12 25.28 25.53 25.74 25.99 26.11 26.27 26.36 26.45 26.57 26.61 26.72 26.61 26.91 27.02 27.08 27.11 27.18 26.78 26.54 26.18 25.75 25.11 24.76 24.56 24.48 24.33 24.29 24.17 24.12 24.08 23.99 23.87 23.72 23.66 23.59 23.39 23.27 23.08 23.01 22.9 22.42 22.14 21.87 20.4 18.79 17.55 16.79 15.21 13.45 11.01 9.94 8.62 4.79 3.98 2.11 1.25 0.3 0.1 0];
bathymetry = bathymetry.'; %give vector pattern orientation
transect = transect.'; %give vector pattern orientation
plot(transect, bathymetry)
%area(transect, bathymetry)
title ('Transect almost there!!')
xlabel ('Transect')
ylabel ('Depth')

类别

帮助中心File Exchange 中查找有关 Oceanography and Hydrology 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by