필터 지우기
필터 지우기

Colour Segments of graph

조회 수: 1 (최근 30일)
Michael Constantine
Michael Constantine 2020년 9월 10일
답변: Monisha Nalluru 2020년 9월 14일
I have plotted a voltage vs time graph and wish to colour sections of it, and want to know the best way to do this? I will attach a screenshot of the graph I have plotted and an example of how I wish to colour it.
Cheers
  댓글 수: 1
KSSV
KSSV 2020년 9월 10일
Read about fill, patch.

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

답변 (1개)

Monisha Nalluru
Monisha Nalluru 2020년 9월 14일
fill, patch functions are used to fill the area under a plot
As an example, you can refer to the following code
x1=0:pi/20:pi;
y1=sin(x1);
patch(x1,y1,'r')
x2=pi:pi/20:2*pi;
y2=sin(x2);
patch(x2,y2,'b')
x3=2*pi:pi/20:3*pi;
y3=sin(x3);
patch(x3,y3,'y');
hold on
x=pi/60:pi/20:pi;
y=sin(x);
fill(x,y,'k') // color some red area by black
hold off

카테고리

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