Getting color in a "timeseries plot"

조회 수: 13 (최근 30일)
anja pedersen
anja pedersen 2016년 12월 30일
댓글: per isakson 2017년 1월 2일
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
Image Analyst
Image Analyst 2017년 1월 2일
Please correct the first link.
per isakson
per isakson 2017년 1월 2일
Fixed it. Thanks!

댓글을 달려면 로그인하십시오.

채택된 답변

Preethi
Preethi 2017년 1월 2일
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
anja pedersen
anja pedersen 2017년 1월 2일
Thank you, i guess that is the best solution, i was hoping there where a simple comand.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Preethi
Preethi 2016년 12월 30일
hello,
you can append 'r', 'g' ....
plot(ts1,'.r')
or
plot(ts1,'.','Color',[0,0.2,0.8])
  댓글 수: 1
anja pedersen
anja pedersen 2016년 12월 30일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by