Plot different color data range

9 ビュー (過去 30 日間)
Hazards
Hazards 2020 年 1 月 8 日
回答済み: Sindar 2020 年 1 月 9 日
Hello everyone,
I want to plot a simple time series over time, but with 2 different colors.
For a specific range of data on my x-axis (time values), I want to change the color.
How can I do that?
Thanks in advance!
  3 件のコメント
Hazards
Hazards 2020 年 1 月 8 日
Of course
darova
darova 2020 年 1 月 8 日
Did it work?

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

回答 (1 件)

Sindar
Sindar 2020 年 1 月 9 日
x = -10:.01:10;
y = sin(x);
idx = x<=0;
plot(x(idx),y(idx),'r*',x(~idx),y(~idx),'b*')

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by