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 Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by