Filter löschen
Filter löschen

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

37 Ansichten (letzte 30 Tage)
maryam
maryam am 11 Sep. 2014
Kommentiert: maryam am 12 Sep. 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 :)

Antworten (2)

Image Analyst
Image Analyst am 11 Sep. 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 Kommentar
maryam
maryam am 12 Sep. 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) ..

Melden Sie sich an, um zu kommentieren.


Joseph Cheng
Joseph Cheng am 11 Sep. 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.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by