MATLAB: Coloring different parts in a plot with different color

areacolorfillplot

Hi,
I have the following plot and I want to color the complete area where red data are present with a different color as compared to the area where blue data are present. Is there any way to do it? I tried with fill and area functions but no luck. Can anyone please help me with this?

Best Answer

You can select the appropriate points, boundary() them, use that to extract an ordered subset of the original points. fill() using those x and y position.