How to plot some xtickslabel that correspond to y data?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello!
I've read a lot of answers about xticklabel and datetick, but i'm very confusing yet.
I have two vectors of 30 points.
y = 30 points
x = 30 points type date string (i've used datestr() from a datenum() number) (HH:MM:SS.FFF). See like this:
' 06:22:19.041'
' 06:22:19.048'
' 06:22:19.050'
' 06:22:19.055' ...
I used the plot function only for the y data:
plot(y);
The x data on the graphic was = 1...5...10...15...20...25...30. (7 numbers!)
So, i changed the xtickslabels:
set(gca, 'XTickLabel', x);
And the xtickslabels changed for the only the first 7 numbers of my x vector.
I need plot few points, as i did, but the points on xticks have to correspond to the y data.
Thanks. Sorry about the language
0 comentarios
Respuestas (1)
Walter Roberson
el 12 de Dic. de 2012
set(gca, 'XTick', 1:length(x), 'XTickLabel', x);
10 comentarios
Ver también
Categorías
Más información sobre Grid Lines, Tick Values, and 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!