Azzera filtri
Azzera filtri

Area fill between minimum and maximum axis limit

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

Star Strider
Star Strider il 4 Ott 2019
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 —

Più risposte (1)

darova
darova il 3 Ott 2019
Use patch()
  1 Commento
BeeTiaw
BeeTiaw il 3 Ott 2019
Modificato: BeeTiaw il 3 Ott 2019
I know, but I could not get what I want
patch([data_1' fliplr(data_1')], [index max(index)*ones(size(index))], 'r');

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by