フィルターのクリア

For loop in a plot

2 ビュー (過去 30 日間)
Sayantan Sahu
Sayantan Sahu 2018 年 4 月 5 日
コメント済み: Star Strider 2018 年 4 月 5 日
I want to plot a line for a certain number of years. The starting point for each line on the y-axis is the 5th percentile and it extends to the 95th percentile. I have the following code,
for ii=1:12
plot([year(ii) year(ii)],[array_5(ii) array_95(ii)],'r','Linewidth',2.4)
end
However, it plots the line only for the last year. What modification do I need for this piece of code ?

採用された回答

Star Strider
Star Strider 2018 年 4 月 5 日
Use the hold (link) function, or alternatively:
hAxes = axes('NextPlot', 'add');
for ii = 1:12
plot(hAxes,[year(ii) year(ii)],[array_5(ii) array_95(ii)],'r','Linewidth',2.4)
end
  2 件のコメント
Sayantan Sahu
Sayantan Sahu 2018 年 4 月 5 日
Thanks it works !!!
Star Strider
Star Strider 2018 年 4 月 5 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by