필터 지우기
필터 지우기

How to get minor ticks pointing outside the graph

조회 수: 31 (최근 30일)
Ahmed Ismail
Ahmed Ismail 2016년 8월 1일
댓글: Ahmed Ismail 2016년 8월 2일
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.

채택된 답변

Walter Roberson
Walter Roberson 2016년 8월 1일
  댓글 수: 2
Ahmed Ismail
Ahmed Ismail 2016년 8월 2일
Hey Walter, this answer worked fine. Though is there a way to only have them on the two axes? rather than all 4 sides of the graph?

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

추가 답변 (1개)

dpb
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'

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by