MATLAB Answers

Shading between two curves

22 views (last 30 days)
Phil A
Phil A on 4 Mar 2018
Edited: njj1 on 12 Mar 2018
Hey, I would like to shade the area between the red curves (.png) and between the green curves. Would be great if someone can help me!
The very best, Philipp

  4 Comments

Show 1 older comment
Star Strider
Star Strider on 8 Mar 2018
Do you want to shade the areas in the original plot (probably using the patch function, and that would require your original data set and the code you use to plot it) or the image of the plot that you posted (since you mentioned ‘(.png)’), that requires an image processing approach?
Also you could provide a bit more detail with respect to ‘the area between the red curves (.png) and between the green curves’ since the area between the green curves includes the area between the red curves.
Phil A
Phil A on 11 Mar 2018
Thanks for your comments. Finally made it work.
Star Strider
Star Strider on 11 Mar 2018
Posting the relevant code (and data) would help others with similar problems.

Sign in to comment.

Answers (1)

njj1
njj1 on 8 Mar 2018
Edited: njj1 on 12 Mar 2018
You can try using the "fill" function (could also use "patch"). Just off the top of my head, if you can compute the area between one of the red/green curve boundaries then use the vector of x and y values to form the polygon. Just remember that the x values will travel from x0 to xmax and back to x0, and the same for the y values. You want to trace the red curve then connect the end of the red curve to the green curve, then travel back up the green curve. So, for example, given the rightmost red/green region, x will go from -2 to about 1.2 then back to -2, and y will go from 0 to 300 and back to 0.

  1 Comment

Phil A
Phil A on 11 Mar 2018
Got it using "patch". Thanks a lot!

Sign in to comment.

Sign in to answer this question.

Tags