Plot - fill area under curve with specific x-values.

Hello,
The goal is to color the areas in the curve areas where the values of the black dashed line are negative. The data are available as measurement results. The first problem is certainly the different areas to read, then the coloring of the various curves. In the appendix an example is to be found, as I imagine (from powerpoint).
Does anyone have an idea to implement this as automated as possible?
Thanks a lot!

4 Comments

This assumes that all the curves in the plot are the same size as the x-axis (independent variable) vector.
First, determine the index values defining the regions where the dashed black line is negative.
Then loop over each of those regions with a series of patch calls to fill the respective regions. The dark blue areas would be filled first, then the red areas, then the cyan areas.
That’s how I would approach it, anyway.
Note: Duplicate of: Fill Area in plot
Thanks for the answer.
How can I use the patch command exactly?
My measurement contains 10000 values (X1, Y1) and between two index values of this curve the area up to the x-axis should be filled.
How can I transfer this restriction to the patch command?
Thank you very much!
Pick up the required coordinates..and use patch
how exactly do I have to integrate the basic function and the limits in the patch command?Unfortunately, my previous attempts have failed ....

Sign in to comment.

Answers (0)

Products

Release

R2018a

Asked:

on 20 May 2019

Commented:

on 21 May 2019

Community Treasure Hunt

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

Start Hunting!