Control long datetime xtick
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Day Hong Kim
el 17 de Abr. de 2021
Comentada: Day Hong Kim
el 18 de Abr. de 2021
Hello. I have an array that starts from 2015 to the end of 2020 every 10 minutes. This is my x-axis. When I plot this the x-axis only shows years, but I would like to show every years and months. I attached the m_file. If you guys know how to do this or tell me some tips for controlling the x-axis, I would be really thankful.
0 comentarios
Respuesta aceptada
Walter Roberson
el 17 de Abr. de 2021
Editada: Walter Roberson
el 17 de Abr. de 2021
basedate = datetime(2015,1,1,0,0,0, 'Format', 'yy/MM');
enddate = datetime(2020,12,31,23,59,59, 'Format', 'yy/MM');
wanted_ticks = basedate + calmonths(0:(2020-2015+1)*12)
sample_dates = linspace(basedate, enddate, 30);
plot(sample_dates, rand(size(sample_dates)))
xticks(wanted_ticks)
Más respuestas (0)
Ver también
Categorías
Más información sobre Axis Labels 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!