Plot different color data range

18 Ansichten (letzte 30 Tage)
Hazards
Hazards am 8 Jan. 2020
Beantwortet: Sindar am 9 Jan. 2020
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 Kommentare
Hazards
Hazards am 8 Jan. 2020
Of course
darova
darova am 8 Jan. 2020
Did it work?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

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

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by