How to get minor ticks pointing outside the graph
20 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a script which plots a histogram, and I have set it so that there is a main xtick every 50. I would like to also have minor ticks every 10, in addition, I want the minor ticks to be unlabelled also and pointing outside the graph. Help on this would be much appreciated. Thanks.
p = Length;
xbins=0.5:1:200.5;
[j,qout] = hist(p,xbins); %Use 30 bins for the histogram
bar(qout,j/sum(j),'k'); %relative frequency is n/sum(n)
xlim([0 200]);
ylim([0 0.025]);
set(gca,'xtick', [0:50:200],'FontSize',15);
set(gca,'XMinorTick','on','YMinorTick','on')
EDIT: I have put
set(gca,'XMinorTick','on','YMinorTick','on')
In the code, but I still don't know how to set those ticks pointing outwards and to have a set no. of them.
0 个评论
采纳的回答
Walter Roberson
2016-8-1
set(gca, 'TickDir', 'out')
As of R2015b there is also a per-axes control of this; see http://www.mathworks.com/help/matlab/ref/numericruler-properties.html
更多回答(1 个)
dpb
2016-8-1
With HG2 (R2015b and later) TMW finally gave such fine detail control...see <Numericruler Properties>. Look for MinorTick, MinorTickValues properties. The direction is set via 'TickDirection' and affects both sets.
If you have an earlier release, the minor ticks are automagically adjusted based on the tick spacing and are not otherwise controllable other than 'on|off'
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!