How to create axis with perfect square ticks

조회 수: 5 (최근 30일)
Afonso Campos
Afonso Campos 2021년 1월 31일
댓글: Afonso Campos 2021년 2월 1일
What should I do to plot my data along a y axis such as this:

채택된 답변

Rik
Rik 2021년 1월 31일
The answer from @Mara provides all the tools you need, but there are still some caveats. Note that the first option will not set the spacing and the second option will cause a mismatch between the values and the labels.
I think the best solution would be to do all of these things:
  • Set the yticks to 0:50
  • Set the yticklabels to (0:50).^2
  • Take the sqrt of your data before plotting it

추가 답변 (1개)

Mara
Mara 2021년 1월 31일
편집: Mara 2021년 1월 31일
yticks((1:50).^2)
if you just want to change the labels you can use
yticklabels((1:50).^2)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by