Plotting a time series with shaded regions
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi I want plot a time series (see below) with shade strips in the background. For example, if the data belongs to 1998, add a light grey strip behind the line. If it belongs to 1999, add a darker grey stripe behind the line and so on. I would also like to have a text box on each strip indicating the period of time. It seems to be a very challenging task for me. can someone help me?
thanks very much.
'6/01/1998' [ 5.41]
'9/01/1998' [5.0933]
'12/01/1998' [ 4.39]
'3/01/1999' [4.6633]
'6/01/1999' [ 4.88]
'9/01/1999' [ 5.16]
'12/01/1999' [5.6067]
'3/01/2000' [6.1867]
'6/01/2000' [6.2167]
'9/01/2000' [ 6.13]
'12/01/2000' [ 5.9]
'3/01/2001' [4.5967]
'6/01/2001' [ 3.78]
댓글 수: 0
답변 (1개)
Yao Li
2014년 5월 16일
time='6/01/1998';
fwd_slash_loc=strfind(time,'/');
year=time(fwd_slash_loc(2)+1:end);
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!