MATLAB Answers

How to create axis with perfect square ticks

4 views (last 30 days)
Afonso Campos
Afonso Campos on 31 Jan 2021
Commented: Afonso Campos on 1 Feb 2021
What should I do to plot my data along a y axis such as this:

Accepted Answer

Rik on 31 Jan 2021
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

More Answers (1)

Mara on 31 Jan 2021
Edited: Mara on 31 Jan 2021
if you just want to change the labels you can use


Community Treasure Hunt

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

Start Hunting!