필터 지우기
필터 지우기

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

조회 수: 37 (최근 30일)
maryam
maryam 2014년 9월 11일
댓글: maryam 2014년 9월 12일
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 :)

답변 (2개)

Image Analyst
Image Analyst 2014년 9월 11일
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
maryam
maryam 2014년 9월 12일
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) ..

댓글을 달려면 로그인하십시오.


Joseph Cheng
Joseph Cheng 2014년 9월 11일
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.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by