How do I create a Contour plot such as below with three interdependent variables?

2 件のコメント

KSSV
KSSV 2020 年 6 月 11 日
Attach your data.
Sahil Patel
Sahil Patel 2020 年 6 月 11 日
I am attaching an excel file with the data.
Thanks for your help.

サインインしてコメントする。

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 6 月 11 日
編集済み: Ameer Hamza 2020 年 6 月 11 日
time = readmatrix('Book1.xlsx', 'Range', 'A2:A202');
dp = readmatrix('Book1.xlsx', 'Range', 'C1:J1');
logDp = readmatrix('Book1.xlsx', 'Range', 'C2:J202');
ax = axes();
contourf(time, dp, logDp.')
colormap(jet)
xlabel('Time');
ylabel('Dp');
ax.ColorScale = 'log';
cb = colorbar(gca, 'Location', 'south');
ax.Position(2) = ax.Position(2) + 0.2; % move axis up
ax.Position(4) = ax.Position(4) - 0.2; % decrease the height
cb.Position(2) = cb.Position(2) - 0.18; % move the colorbar down

その他の回答 (1 件)

KSSV
KSSV 2020 年 6 月 11 日
data = xlsread("Book1.xlsx") ; % you can use readtable also
data(:,2) = [] ; % second column if NaN's remove it
x = data(1,2:end) ; % x axis
y = data(2:end,1) ; % y-axis
Z = data(2:end,2:end) ; % data matrix
pcolor(x,y,Z)
shading interp ;
colorbar

カテゴリ

ヘルプ センター および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by