How to fill the area between lines in gray shade

6 ビュー (過去 30 日間)
janas
janas 2023 年 12 月 11 日
コメント済み: Star Strider 2023 年 12 月 11 日
How can I fill the area between the lines on the figure attached by gray background

採用された回答

Star Strider
Star Strider 2023 年 12 月 11 日
This becomes a bit more complicated with multiple lines.
This assumes you want the gray region between the maximum and minimum line values —
x = linspace(0, 5, 10).';; % Assume Column Vectors
y = ([0.5 0.75 0.9 0.95 1.1] + x*(1:5))*1E+6;
figure
plot(x, y) % Plot Lines
hold on
patch([x; flip(x)], [min(y,[],2); flip(max(y,[],2))], [1 1 1]*0.5, 'FaceAlpha', 0.25) % Plot Gray 'patch'. Set 'FaceAlpha' (Transparency) To Show Lines
hold off
xlabel('Jahr')
ylabel('BoddenVolume in m^3')
lgdstr = compose('Limit 0.01 Cutoff %3d',[95 98 99 100]);
legend('PIZ', lgdstr{:}, 'Location','best')
.
  2 件のコメント
janas
janas 2023 年 12 月 11 日
I appreciate your help, it worked.
Star Strider
Star Strider 2023 年 12 月 11 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by