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

Is it possible to fill the area between two function on a plot with transparent colour?

 採用された回答

Mischa Kim
Mischa Kim 2015 年 4 月 21 日
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

2 件のコメント

Ruoyao
Ruoyao 2017 年 9 月 29 日
Thank you Mischa, your answer was very helpful! Then I added the legend, but the colors in the legend were still solid. How could I make them transparent as well? Thanks!
Ruoyao
Ruoyao 2017 年 9 月 29 日
編集済み: Ruoyao 2017 年 9 月 29 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeColor and Styling についてさらに検索

質問済み:

2015 年 4 月 21 日

編集済み:

2017 年 9 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by