Higlight parts of plot with different color

64 ビュー (過去 30 日間)
sc1991
sc1991 2017 年 12 月 1 日
コメント済み: sc1991 2017 年 12 月 1 日
Hi! I have a time series data set which I have plotted. on top of that I want to show few sections with different colour.
Something How I have in the figure attached. Can anyone Help. Rite now what I am thinking is making two arrays one with the entire Time series Data and the other with the data that I want to highlight and filling the rest with NaNs and plotting them on top of each other. But I am not sure. Can anyone help me with this???

採用された回答

Birdman
Birdman 2017 年 12 月 1 日
One approach:
x=1:20;
y=2*x;
z=y(6:14);
plot(x,y);hold on;plot(x(6:14),z,'Color','r')
  1 件のコメント
sc1991
sc1991 2017 年 12 月 1 日
Yup worked. Thanks for the help

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by