How can I add more tick labels to my graph? When opened I only get two tick labels and now and again I wont change anything and it will give me 5 or 6 labels. Is there a way i can speciify exactly how many labels i require?
function plot_tide_data(tidedata)
figure(1)
clf
plot(tidedata.t,tidedata.h,'b-')
datetick('x','dd/mmm')
xlabel('Day of Month','fontsize',15)
ylabel('Tidal Height (m)','fontsize',15)
set(gca,'Xminortick','on')
set(gca,'Yminortick','on')
set(gca,'tickdir','in')
grid on
set(gcf, 'PaperPositionMode', 'auto');
set(gca,'linewidth',2)
u = get(gca,'XtickLabel');
set(gca,'XtickLabel',u,'fontsize',20)
set(gca,'linewidth',1.5)
xlim([737739 737750])

 採用された回答

Adam Danz
Adam Danz 2019 年 12 月 2 日
編集済み: Adam Danz 2019 年 12 月 3 日

0 投票

Adjust xtick axis property.
This method below specifies 6 ticks that start and end at your existing tick bounds
ax = gca();
ax.XTick = linspace(ax.XTick(1),ax.XTick(end),6);
%---------------------------------------------^ 6 ticks

2 件のコメント

Thomas Maw
Thomas Maw 2019 年 12 月 3 日
Thank you!
Adam Danz
Adam Danz 2019 年 12 月 3 日
Glad I could help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2019 年 12 月 2 日

コメント済み:

2019 年 12 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by