draw a line at the coordinates and paint it

조회 수: 7 (최근 30일)
Lev Mihailov
Lev Mihailov 2019년 11월 22일
댓글: darova 2019년 11월 22일
I did how to draw a line along the coordinates, but I don’t know how to color it.
a=[110 120 70 140 150]
b=[20 30 40 50 80]
red=[3 2 1 2 3]
plot(a,b)
1.png
it shows how this can be done in another program. I have such a question, is it possible to do this in Matlab ???
p.s. the main thing is that on the line it would be possible to distinguish between changes
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 11월 22일
How does the red array correspond to changes in the color of the line? You change color at about 83 or so, but none of your variables have value that is about 83, and you change back around 108 or so; that could plausibly be at the same 110 as your first a value, but you do not have any 110 coded in the middle of an array that might signal a change at that location.
darova
darova 2019년 11월 22일
Did you try?
plot(x,y,'color','r')

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

답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 22일
편집: KALYAN ACHARJYA 2019년 11월 22일
a=[110 120 70 140 150]
b=[20 30 40 50 80]
red=[3 2 1 2 3]
plot(a,b,'r','linewidth',10)
%........^ color..........^ width of the line

Walter Roberson
Walter Roberson 2019년 11월 22일

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by