フィルターのクリア

How to access axis' secondary label (power of ten)?

13 ビュー (過去 30 日間)
Stephan Heise
Stephan Heise 2013 年 9 月 4 日
編集済み: Adam Danz 2023 年 10 月 18 日
Hi,
I was wondering how one can access/control the secondary axis labels that display the power of ten and that are generated when axis limits are larger than round about 10^5. I'm not really sure how they're called so here's a picture of what I mean:
The reason why I ask is because I would like to have axis labelling in engeneering notation, i.e. only powers of ten that divide by 3 (10^3, 10^6, 10^9, etc.).
I read in Yair Altman's blog that with HG2 this part of the axes is accessible via the axes' YRuler.SecondaryLabel property. Does anyone know of a way to control it within HG1?
Stephan.

回答 (3 件)

the cyclist
the cyclist 2013 年 9 月 4 日
Just as an alternative ...
I often divide my plotted values by the appropriate power of 10 [e.g. plot(x/1e3,y/1e6)] and then notate that in the label
xlabel('Awesomeness [thousands]')
ylabel('Coolness [millions]')
  1 件のコメント
Stephan Heise
Stephan Heise 2013 年 9 月 9 日
Thanks for the suggestion! I've also sometimes done that dividing work-around; but I just wondered whether there's a possibility to directly influence the (automatic) tick label format. :)

サインインしてコメントする。


Jan
Jan 2013 年 9 月 9 日
A good question. Sometimes these secondary tick labels do not disappear when the tick-labels are removed or changed.
I've tried a lot, but did not find a method to access these labels, neither with documented nor undocumented methods.

Adam Danz
Adam Danz 2023 年 10 月 12 日
編集済み: Adam Danz 2023 年 10 月 18 日
Starting in MATLAB R023b, you can use xsecondarylabel, ysecondarylabel, and zsecondarylabel functions to set, update, or turn off the secondary labels.
For more info and a demo, see this Graphics and App Buidling blog article
  1 件のコメント
Steven Lord
Steven Lord 2023 年 10 月 12 日
Even before that, if you just want to change the exponent on the axes you can do this using the Exponent property of the ruler object (at least as far back as release R2019a, which is as far back as I checked in the documentation.)
x = 1:10;
plot(x, x.^8)
title('With exponent')
figure
plot(x, x.^8)
ax = gca;
ax.YAxis.Exponent = 0;
title('Without exponent')

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxes Appearance についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by