フィルターのクリア

How to loop different y-labels in different plots?

2 ビュー (過去 30 日間)
Armando MAROZZI
Armando MAROZZI 2020 年 4 月 3 日
コメント済み: Ameer Hamza 2020 年 4 月 3 日
I want to display 4 graphs of Impulse Response Functions (IRFs) with their confidence intervals. I would like the labels to appear in bold on the y-axis. I tried this code but it doesn't display the y-axis as plotdisplay says. Besides, when I run the code, the order of the plots doesn't reflect the order of the variables and one (the last one) isn't displayed.
plotdisplay = {'Fiscal Policy Accommodation', 'HICP', 'Real GDP', 'Policy Indicator'}
for j = 1:4
plot(VAR.irs(:,j),'LineWidth',2,'Color', [0 0 0.5]);
hold on
plot(VARbs.irsH(:,j),'LineWidth',1,'Color', [0 0 0.5],'LineStyle','--');
hold on
plot(VARbs.irsL(:,j),'LineWidth',1,'Color', [0 0 0.5],'LineStyle','--');
subplot(size(VAR.irs, 2), 1, j);
xlabel('months')
ylabel(plotdisplay(j), 'bold')
end
What is wrong in this code?
Thanks

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 3 日
編集済み: Ameer Hamza 2020 年 4 月 3 日
Change to
ylabel(plotdisplay(j), 'FontWeight', 'bold')
Also move the subplot statement above
for j = 1:4
subplot(size(VAR.irs, 2), 1, j);
plot(VAR.irs(:,j),'LineWidth',2,'Color', [0 0 0.5]);
hold on
% remaining code.
end
  6 件のコメント
Armando MAROZZI
Armando MAROZZI 2020 年 4 月 3 日
impressive! Thanks a lot!
Ameer Hamza
Ameer Hamza 2020 年 4 月 3 日
Thanks. Glad to help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by