Area fill between minimum and maximum axis limit

3 次查看(过去 30 天)
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 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by