How can I make this line start from a specific date?

4 visualizaciones (últimos 30 días)
Pul
Pul el 4 de Sept. de 2021
Editada: Pul el 5 de Sept. de 2021
Hello everyone,
How can I make the magenta line start from a specific date (14 Jan 2015) in the graph, instead of 1 Jan 1998?
% Lv = DTv <= datetime('7-Jan-2020');
Thank you!

Respuesta aceptada

Star Strider
Star Strider el 4 de Sept. de 2021
Change ‘Lv’ to:
Lv = (DTv <= datetime('7-Jan-2020')) & (DTv >= datetime('14-Jan-2015'));
and it should do what you want.
Consider adding:
xlim([min(DTv(Lv)) max(DTv(Lv))])
after the plot calls that use ‘DTv’ to restrict the x-axis limits. This is not required, however it would avoid whitespace at the ends of the plots.
.
  6 comentarios
Pul
Pul el 5 de Sept. de 2021
Yes, perfect.
Thank you!
Star Strider
Star Strider el 5 de Sept. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by