Area fill between minimum and maximum axis limit

조회 수: 2 (최근 30일)
BeeTiaw
BeeTiaw 2019년 10월 3일
답변: Star Strider 2019년 10월 4일
Hi,
What is the easiest way to fill up the area of the following data:
data=[
15057 11.276 13.607
15058 11.275 13.612
15058 11.272 13.618
15059 11.27 13.624
15059 11.268 13.63
15060 11.266 13.636
15060 11.263 13.642
15061 11.261 13.648
15061 11.259 13.654
15062 11.256 13.659
15062 11.254 13.665
15063 11.252 13.671
15063 11.25 13.677
15064 11.247 13.683
15064 11.245 13.689
15065 11.243 13.695
15065 11.24 13.701
15066 11.238 13.707
15066 11.236 13.712
];
idx = data(:,1)
data_1 = data(:,2);
data_2 = data(:,3);
What I intend to do is to fill the area from the left-limit to data_1 (with red) and from data_2 right-limit (with blue)]. Thus, the area in between the two curve will be white.

채택된 답변

Star Strider
Star Strider 2019년 10월 4일
You need to create a closed area for patch, that proceeds clockwise (or anticlockwise).
The Code —
figure
patch([data_1; flipud(data_2)], [idx; flipud(idx)], 'r')
ylabel('Index')
The Plot —

추가 답변 (1개)

darova
darova 2019년 10월 3일
Use patch()
  댓글 수: 1
BeeTiaw
BeeTiaw 2019년 10월 3일
편집: BeeTiaw 2019년 10월 3일
I know, but I could not get what I want
patch([data_1' fliplr(data_1')], [index max(index)*ones(size(index))], 'r');

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

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by