How to let y-axis ticks increase by 2?

조회 수: 2 (최근 30일)
AbelM Kusemererwa
AbelM Kusemererwa 2015년 7월 23일
답변: Azzi Abdelmalek 2015년 7월 23일
How to let y-axis ticks increase by 2? The number on the y-axis should also be in 2 decimal places. What codes will I use?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 23일
Look at this
t=0:0.001:10;
y=12.5*sin(t)
plot(t,y)
yt=get(gca,'ylim')
nyt=yt(1):2:yt(2)
ytl=cellfun(@(x) sprintf('%.2f',x),num2cell(nyt),'un',0)
set(gca,'ytick',nyt,'yticklabel',ytl)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by