YAxis Exponent doesnt change after flipping YTick

2 ビュー (過去 30 日間)
David Pyles
David Pyles 2017 年 7 月 27 日
コメント済み: Walter Roberson 2017 年 7 月 31 日
I need to reverse the yaxis index, then flip the image. However the exponential disappears after the YDir is set to 'Reverse'. The MATLAB suggested dot notation is not working in the following example that should accomplish all of these tasks:
open 'myfig.fig'
figure(1); subplot 311; % I don't think this matters here, but maybe doing this in a subplot is an issue
yTicks = get(gca, 'YTick'); % get yaxis index
yTicksReverse = sort(yTicks, 2, 'descend'); % reverse yaxis index
set(gca, 'YTickLabel', num2str(yTicksReverse')); % set reversed index to figure
set(gca, 'YDir', 'reverse'); % flip image, along with the y axis.
ax = gca;
ax.YAxis.Exponent = 6;
After this code is run, looking at the ax.YAxis values does show that the exponent assignment has been set to 6, however it does not change on the figure itself :(

回答 (1 件)

Shruti Shivaramakrishnan
Shruti Shivaramakrishnan 2017 年 7 月 31 日
編集済み: Walter Roberson 2017 年 7 月 31 日
Also, if it is helpful, converting the Tick values to a decimal value can be done using :
>> ax.XAxis.TickLabelFormat = '%.60f';
Then if you'd like the Exponent to be displayed:
>> ax.XAxis.Exponent = 6;
  3 件のコメント
Steven Lord
Steven Lord 2017 年 7 月 31 日
Define "no longer works" -- does it throw an error? If so what is the FULL text of the error message? Does it issue a warning? Ditto on the full message in that case. Does it do something else (and if so, describe what EXACTLY it does.)
Walter Roberson
Walter Roberson 2017 年 7 月 31 日
Question: is this XAxis Exponent or YAxis Exponent that we are talking about?
The use of the axis exponent is disabled when you set tick labels manually.

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

カテゴリ

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