How to create axis with perfect square ticks

 Respuesta aceptada

Rik
Rik el 31 de En. de 2021

2 votos

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

Más respuestas (1)

Mara
Mara el 31 de En. de 2021
Editada: Mara el 31 de En. de 2021
yticks((1:50).^2)
if you just want to change the labels you can use
yticklabels((1:50).^2)

Categorías

Etiquetas

Preguntada:

el 31 de En. de 2021

Comentada:

el 1 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by