plot shaded areas between two vertical lines

조회 수: 22 (최근 30일)
Alex
Alex 2021년 2월 9일
답변: Youssif Mosa 2023년 12월 7일
Hello,
I would like to plot a time series with years on x axis and values between 0 and 1 on the y axis. I need to plot on the same graph another series that takes only values 0 an 1 and to shade the areas in which this is equal to 1. Hence I would need vertical lines when the series equals 1 and to shade the areas in which this happens.
Could anyone help me please?
Thank's
  댓글 수: 2
darova
darova 2021년 2월 9일
DId you try patch?
Adam Danz
Adam Danz 2021년 2월 9일
... or fill() but I lean toward using patch() as darova recommended.

댓글을 달려면 로그인하십시오.

답변 (1개)

Youssif Mosa
Youssif Mosa 2023년 12월 7일
since 2023a you can use function xregion.

카테고리

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