I would like to specifiy the number of digits in the tick labels of an axis but keeping 0 as it is.
For instance, in the following example:
x = rand(30,1);
y = rand(30,1);
scatter(x,y);
ytickformat('%.2f')
Is it possible to keep 0 unchanged, instead of 0.00?
Thanks

댓글 수: 1

Mohammad Sami
Mohammad Sami 2020년 1월 28일
You can use yticks and yticklabels to create the labels.

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

 채택된 답변

Sindar
Sindar 2020년 1월 29일

0 개 추천

x = rand(30,1);
y = rand(30,1);
scatter(x,y);
ytickformat('%.2f')
% get all the labels
yt=yticklabels;
% replace the first one with 0, and leave the rest alone
yticklabels(['0' ;yt(2:end)])

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

질문:

2020년 1월 28일

댓글:

2020년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by