From: Jack on
I am plotting a figure in Matlab. The range is from -4e6 to +4e6. So one axis has the ticks -4, -3... 1 2 3 4 and then a 'x 10^6' at the top of the axis. I would like to add a unit to the 'x 10^6' such that it reads 'x 10^6m' but I can't find out how to do it. When a add a figure label, it places the label text far away from the scientific notation.

Any ideas?

Thanks!
From: Walter Roberson on
Jack wrote:
> I am plotting a figure in Matlab. The range is from -4e6 to +4e6. So
> one axis has the ticks -4, -3... 1 2 3 4 and then a 'x 10^6' at the top
> of the axis. I would like to add a unit to the 'x 10^6' such that it
> reads 'x 10^6m' but I can't find out how to do it. When a add a figure
> label, it places the label text far away from the scientific notation.

This is not _impossible_ to do, but it is significantly messier than you
would expect. The exponent is being placed automatically, and only in
the case where YTickMode is 'automatic', and there is no deliberate
user-level control over it. In order to modify it, you would have to
locate the hidden child of the axis of object type text() and set() the
String property of that child, and possibly nudge the Position a little
if the result overlaps something else.