How to create axis with perfect square ticks

2 ビュー (過去 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 Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by