Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab - change axis multiplier

Could you tell me how can I change an axis "multiplier"? I mean a value I circled in the picture, let's say I would like to have x10^3 instead of x10^4.

enter image description here

like image 644
kozooh Avatar asked Nov 24 '13 21:11

kozooh


2 Answers

As of R2015b it is part of the Numeric Ruler Properties:

ax = get(gca);
ax.YAxis.Exponent = -3;
like image 122
Ben B Avatar answered Oct 06 '22 23:10

Ben B


I have little bit tricky solution:

  1. Set YTickMode to manual.
  2. Set your own YTickLabel.
  3. Place the text on top with your desired multiplier.

here is:

set(gca, 'YTickMode', 'manual');
set(gca, 'YTickLabel', get(gca,'YTick') / 1000);
text(0, 1.02 * get(gca,'YLim')(2), 'x 10^3');

Play with the multiplier 1.02 in the third line to place your text to the good place.

like image 44
vz_ Avatar answered Oct 06 '22 23:10

vz_