How to plot shaded rectangles?

조회 수: 42 (최근 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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by