필터 지우기
필터 지우기

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 CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by