How to create shaded areas on graph which overlap
Show older comments
I need to create multiple shaded areas delimited by horizontal lines in a graph. They should also be partly transparent. I am using area(X,Y,LEVEL) and then alpha(0.1) for transparency to ensure the overlap of the areas blend the two colours. I tried the following but once I add a second area, the first one automatically goes to the same LEVEL as the second. What I need is one part to be red, one to be blue and the overlapping part should be a mix (purple).
x2=([0,15]);
y2=([5.7,5.7]);
y3=[16.6,16.6];
y4=[11.4,11.4];
y5=[34.6,34.6];
II=area(x2,y5,11.4,'EdgeColor', 'none', 'FaceColor', 'r');
alpha(0.1)
hold on
I=area(x2,y3,5.7,'EdgeColor', 'none', 'FaceColor', 'b');
alpha(0.1);
hold off
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!