Borrar filtros
Borrar filtros

how to increase the number of values displayed on the X-axis matlab

36 visualizaciones (últimos 30 días)
maryam
maryam el 11 de Sept. de 2014
Comentada: maryam el 12 de Sept. de 2014
Hi!
I have a couple of points that their y value is changing with date. When I plot it regularly it is fine but when I plot it in a subplot it automatically does not show all the dates in x axis and just show the min and max date. I was wondering how I can get Matlab to display all the points. Attached please find the plots.
Thanks :)

Respuestas (2)

Image Analyst
Image Analyst el 11 de Sept. de 2014
That's probably all it thought it could comfortably fit. Look up tick marks and tick labels in the help to see how you can manually set them with the set(gca, 'XTick'...) and set(gca, 'XTickLabel',.....) function calls.
  1 comentario
maryam
maryam el 12 de Sept. de 2014
I actually tried to input the x-axis through "set(gca,'XTick',...)" but it did not work and I guess it is because I am using datetick('x',6) ..

Iniciar sesión para comentar.


Joseph Cheng
Joseph Cheng el 11 de Sept. de 2014
you'll have to do something like this after you create the subplot.
newLim = get(gca,'XLim');
newx = linspace(newLim(1), newLim(2), 10);
set(gca,'XTick', newx);
datetick(gca,'x','HH:MM:SS','keepticks');
you'll have to play around with the number of ticks created with the linspace due to the limited space to display the day/time.

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