plot shaded areas between two vertical lines

29 visualizzazioni (ultimi 30 giorni)
Alex
Alex il 9 Feb 2021
Risposto: Youssif Mosa il 7 Dic 2023
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 Commenti
Adam Danz
Adam Danz il 9 Feb 2021
... or fill() but I lean toward using patch() as darova recommended.

Accedi per commentare.

Risposte (1)

Youssif Mosa
Youssif Mosa il 7 Dic 2023
since 2023a you can use function xregion.

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by