フィルターのクリア

Plot value during months (stackedplot)

1 回表示 (過去 30 日間)
BN
BN 2020 年 4 月 7 日
コメント済み: Ameer Hamza 2020 年 4 月 7 日
Hey all
I want to stackedplot vlaues of models for each month of a year, I have 7 models.
In the array that attached, I have 12 columns (month) and 7 rows (models).
Please let me know how I can plot every model's value, all in one figure using a certain line color for each model during months.
I tried this but didn't accomplish well:
for i = 1:numel(C1)
figure
hold on
stackedplot(C1(i,:))
end
set(gca,'xtick',1:12,...
'xticklabel',{'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'})
legend('model1','model2','model3','model4','model5','model6','model7')
Thanks

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 7 日
try this
Months = datetime(2000,1,1):calmonths(1):datetime(2000,12,1);
t = splitvars(table(Months', C1'));
t.Properties.VariableNames = {'month','model1','model2','model3','model4','model5','model6','model7'};
figure
stackedplot(t, 'XVariable', 'month')
  2 件のコメント
BN
BN 2020 年 4 月 7 日
Thank you !
Ameer Hamza
Ameer Hamza 2020 年 4 月 7 日
Glad to be of help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by