Draw vertical lines which have constant interval
Mostrar comentarios más antiguos
Hi, I attached time(datetime, 1980.1.1~2015.12.31) and set y value as P=[1:432].
* I convert date form.I also attached original time form(original_time)
time = datetime(original_form,'ConvertFrom','datenum');
If i draw the plot, i got below figure.
plot(time,P);
datetick('x','yy/mm','keeplimits');
grid on

And i want to add constant vertical line on every March.
I couldn't fine proper method. Please help me :(
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 3 de Oct. de 2022
Editada: Walter Roberson
el 3 de Oct. de 2022
time = datetime(original_form,'ConvertFrom','datenum');
plot(time, P);
firstmarch = dateshift(time(1), 'start', 'year') + calmonths(2);
lastmarch = dateshift(time(end), 'start', year') + calmonths(2);
marchs = firstmarch : calmonths(12) : lastmarch;
xline(marchs)
1 comentario
주희 박
el 5 de Oct. de 2022
Categorías
Más información sobre Calendar en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
