How to plot shaded rectangles?

43 ビュー (過去 30 日間)
Caleb Rosenberg
Caleb Rosenberg 2022 年 10 月 7 日
コメント済み: Caleb Rosenberg 2022 年 10 月 7 日
In the picture of the plot below there are shaded red rectangles. How can I plot rectangles like that? Thank you

採用された回答

Paul
Paul 2022 年 10 月 7 日
One option is rectangle. Can make the color whatever you want, but not transparent
t = 0:.01:1;
plot(t,sin(10*t))
grid
r = rectangle('Position',[0 0 .2 0.8]);
r.FaceColor = 'r';
Transparency can be achieved with a patch
p = patch([0.4 0.4 0.6 0.6 0.4],[0 -1 -1 0 0],'r','FaceAlpha',0.5);
  1 件のコメント
Caleb Rosenberg
Caleb Rosenberg 2022 年 10 月 7 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by