Area fill between minimum and maximum axis limit

3 ビュー (過去 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 Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by