フィルターのクリア

How can I create a shaded plot like the figure sample shown here?

4 ビュー (過去 30 日間)
juan sanchez
juan sanchez 2021 年 10 月 6 日
コメント済み: Star Strider 2021 年 10 月 6 日
How can I create a shaded plot like the figure sample shown here? They are to delineate one zone in darker grey and another one in lighter grey. Please provide sample code if possible.

採用された回答

Star Strider
Star Strider 2021 年 10 月 6 日
Try something like this, using patch
x = linspace(70, 130, 12);
y = rand(2, numel(x));
figure
plot(x, y)
grid
hold on
patch([85 105 105 85], [[1 1]*min(ylim) [1 1]*max(ylim)], [1 1 1]*0.8, 'FaceAlpha',0.5, 'EdgeColor','none')
patch([105 115 115 105], [[1 1]*min(ylim) [1 1]*max(ylim)], [1 1 1]*0.6, 'FaceAlpha',0.5, 'EdgeColor','none')
hold off
Experiment to get the desired result.
.
  2 件のコメント
juan sanchez
juan sanchez 2021 年 10 月 6 日
Thats amazing! Thank you very much!
Star Strider
Star Strider 2021 年 10 月 6 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

その他の回答 (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