Move axis exponent into the tick labels?

For a histogram or graph with large axis label values (xx.yy x 10^N), is it possible to move the 10^N from the end of the axis into each individual label?

Using the x-axis as an example:

|--------------|--------------|--------------| x 10^3 0 1.5 3.0 4.5

would become

|--------------|--------------|--------------| 0 1.5x10^3 3.0x10^3 4.5x10^3

(This is an odd request, but a journal editor is insisting that I change this in my plots prior to publication.)



That’s not implemented that way. x10 is always drawn at the en of the axis.

Now implemented in 5.34 and trunk

  • New static function to change the position of the "power of 10"
    near the axis. A static function is used instead of data members
    in TAxis in order to keep the TAxis class small. Adding two
    floating point numbers in that class (in fact in TAttAxis) would
    have a none negligible effect on the Root files’ sizes as there is
    at least two axis per histogram and that there is often 1000th
    histograms in a single file.
    So we choose to follow the same mechanism as for the SetMaxDigits
    static method. The new function is: SetExponentOffset.
   TGaxis::SetExponentOffset(-0.01, 0.01, "y"); // X and Y offset for Y axis
   TGaxis::SetExponentOffset(-0.05, 0.01, "x"); // Y and Y offset for X axis

Dear all

I see that it is possible to offset the Exponent for the X and Y axis. Is it possible to have this also for the Z-axis (e.g. for a TH2F drawn with colors)?
Thanks a lot

It is implemented for x and y axis only.

Thanks, that is what I understood as well. So no solution let’s say.
I acknowledge that this is only aesthetics, so no high priority.
in case someone touches code nearby in the future, it would be great
to have it also for the Z-axis.

I will check in TGaxis

Thanks :slight_smile:

May be it is better to fill a Jira report to not forget. I had no time to look at it recently.