Why are minor ticks not being added to my graph?
이전 댓글 표시
I used this resource to find how to add minor ticks: https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.decorator.numericruler-properties.html
I added it to my code below but it does not show up on my graph as seen in the picture (found under comments):
figure (1)
scatter(G.Date, G.("Avg_ESDiamiter"), 'LineWidth',1 ) ;
ax1 = gca ;
ax1.LineWidth = 1.5 ;
ax1.XAxis.MinorTick = 'on' ; % Here is where I added minor ticks
fontsize(gca, 12,'points') ;
xtickformat("MM-dd") ;
xtickangle(315) ;
채택된 답변
추가 답변 (1개)
d=datetime(2024,6,3+[0:35],'format','MM-dd'); % datetimes by day
scatter(d,rand(size(d)))
hAx=gca;
hAx.XAxis.MinorTickValues=d; % daily minor ticks
hAx.XAxis.MinorTick='on'; % and display...
box on
% this is an as far as I can tell, undocumented trick to turn off the secondary "year" label
hAx.XAxis.TickLabels=hAx.XAxis.TickLabels;
Have to both turn them on and give values...
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


