How to fill the area between two function on a plot with transparent colour?

18 views (last 30 days)
Is it possible to fill the area between two function on a plot with transparent colour?

Accepted Answer

Mischa Kim
Mischa Kim on 21 Apr 2015
It is. Try, e.g.
d = 0.1;
x = linspace(0,1,20);
z = d*x.^2;
fill([x flip(x)],[z zeros(size(z))],'k','LineStyle','none')
hold on
plot(x,z,'k-');
alpha(0.25)
grid

More Answers (0)

Community Treasure Hunt

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

Start Hunting!