Dynamic colors in a plot

조회 수: 6 (최근 30일)
luke
luke 2013년 7월 25일
Hi, I have a trajectory of a particle so I have its (x,y) coordinates over a time [0,13s].
If I plot; plot(x,y,'--') then I can see where the particle has been, but it doesn't tell me at what time the particle was at that position.
I want to change the color of the line so that at the beginning (t=0s) the line is blue (or some color) and then progressively changes to red (or some different color). In this way I can see where the particle is at particular times.
The command comet looks promising too but the line does not change color.
Could someone please help me with this?
Thanks Luke

답변 (1개)

Jim Hokanson
Jim Hokanson 2013년 7월 25일
Perhaps you want to check out the FEX for cline submissions.
Might be other better ones out there. Not sure if the support 2d or if you'll need to modify their code a bit. Good luck.
  댓글 수: 1
luke
luke 2013년 7월 25일
EXACTLY what I needed. Thank you very much!

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by