Applying time axis limits to plots in UTC time
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi folks, I was wondering if someone could help with some trouble I am having with regards to the formatting of some graphs I have made.
After some time I have managed to get my graphs to output what I need, with the x-axis displaying in hh:mm:ss of the day (duration type) as I had hoped. I can still apply y-axis limits using the standard ylim function since these values are decimal. However, I am unable to use xlim for my time axis to clip my plots accordingly.
Using, for example, xlim([11:17:00 11:17:30]) returns an error stating that limits 'must be a 2-element vector of increasing durations'. When i convert these hh:mm:ss times back into seconds and try the xlim, I get the same error. Does anyone know how I might go about fixing this with time durations in this format?
Thanks.
0 comentarios
Respuesta aceptada
Voss
el 13 de Mzo. de 2024
Here's an example of setting the axes x-limits using duration values:
x = duration(1,1:30,0) % duration x
y = rand(size(x)); % random y
plot(x,y) % plot
xl = duration(1,[10 15],0) % duration x-lim values
xlim(xl) % apply the x-lim
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations 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!