Filter löschen
Filter löschen

Getting color in a "timeseries plot"

4 Ansichten (letzte 30 Tage)
anja pedersen
anja pedersen am 30 Dez. 2016
Kommentiert: per isakson am 2 Jan. 2017
Hi, I am plotting a timeseries using a function like this "ts1 = timeseries(DD1,1:length(DD1))" I manage to plot "plot(ts1,'.') and it looks nice. However I would like to get color into the graph based on a second vector. Is this possible? I know "scatter" has this function but it does not work on my ts data..
What i want is date on x-axis, Wind direction on y-axis and Wind speed displayed as color. Can anyone help me please?
  3 Kommentare
Image Analyst
Image Analyst am 2 Jan. 2017
Please correct the first link.
per isakson
per isakson am 2 Jan. 2017
Fixed it. Thanks!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Preethi
Preethi am 2 Jan. 2017
hello,
in that case you can use for loop, I tried to provide basic example..
for i=1:length(ts1)
if ts1(i)<criteria_1
plot(ts1,'.','y')
hold on
else
plot(ts1,'.','r')
hold on
end
end
  1 Kommentar
anja pedersen
anja pedersen am 2 Jan. 2017
Thank you, i guess that is the best solution, i was hoping there where a simple comand.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Preethi
Preethi am 30 Dez. 2016
hello,
you can append 'r', 'g' ....
plot(ts1,'.r')
or
plot(ts1,'.','Color',[0,0.2,0.8])
  1 Kommentar
anja pedersen
anja pedersen am 30 Dez. 2016
Yes that changes the color from blue to red. But i want each "dot" ('.') to have a color based on what the Wind speed is. Sorry I am not the best at explaning Things.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by