Surface plot from excel data
古いコメントを表示
Hi there,
Could anyone please help me with plotting 3d surface graph of the attached excel data.
回答 (1 件)
Ameer Hamza
2020 年 11 月 13 日
編集済み: Ameer Hamza
2020 年 11 月 13 日
This is one way
data = readtable('load.xlsx');
month_names = data.Properties.VariableNames(2:end);
x = 1:numel(month_names);
y = data.Hour;
z = data{:, 2:end};
ax = axes();
[X, Y] = meshgrid(x, y);
surf(X, Y, z)
ax.XTick = x;
ax.XTickLabel = month_names;
ax.XTickLabelRotation = -45;

In case you need to plot lines
data = readtable('load.xlsx');
month_names = data.Properties.VariableNames(2:end);
x = 1:numel(month_names);
y = data.Hour;
z = data{:, 2:end};
ax = axes();
[X, Y] = meshgrid(x, y);
plot3(X, Y, z)
ax.XTick = x;
ax.XTickLabel = month_names;
ax.XTickLabelRotation = -45;
grid on

カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!