Force scientific notation in TAxis

Hi,

I know there’s a way to suppress the exponent for TAxis labels, is there a way to force an exponent for values which aren’t exponentiated by default?

Also is there a way to make a pad visible through another pad? I though it would be possible via TPad::SetFillStyle(4000), but it doesn’t seem to work.

Cheers,

Hugh

Use :

TGaxis::SetMaxDigits(2);
1 Like
   pad->SetFillColor(0);
   pad->SetFillStyle(4000);

Fantastic, thanks!

Hi again,

Regarding the exponentiation of the axis, the solution you proposed applies to all axes, which is not usually the desired behaviour i.e. often one just wants to alter the plotting of one axis. It would be nice in future versions of ROOT to have a method of TAxis which explicitly controls the number of plotted digits, something like TAxis::SetMaxDigits().

Cheers,

Hugh

Yes it is implemented that way: for all axis. There is a global variable in TGaxis:

Int_t TGaxis::fgMaxDigits = 5;

It’s been a long time, but is there a “per axis” option for the format option?

Hi all,

the question is if this sort of attributes really need to be stored with
each histogram.
Wouldnt be an entry for each axis in TStyle sufficient?

For backward compatibility one could keep the current behavior
but overwrite it in case of ForceStyle = true

This reminds me of a basic discussion long time ago (2004??)
on what should be stored for a histogram on file.

Cheers
Otto

Hi Otto,

If we put this attribute in TStyle it will not be individual either. The current implementation is very similar to a “TStyle one” i.e.: it is a global attribute, not an individual one. As explained in the Jira ticket adding attributes in TAxis may have a serious impact size-wise.

Cheers,
Olivier

HI Olivier,

I agree with your arguments on storage

What I ask for is a different value e.g. for X and Y axis
in the same histogram at “Painting” time.

Cheers
Otto

You mean sth like:

gStyle->SetMaxDigitsX(3);
gStyle->SetMaxDigitsY(4);
h->Draw();

gStyle->SetMaxDigitsX(2);
gStyle->SetMaxDigitsY(5);
other_h->Draw();

right?

yes
Otto

Good point I have reopen sft.its.cern.ch/jira/browse/ROOT-35
accordingly.

This is now implemented as Otto suggested. You can now do:

h->GetXaxis()->SetMaxDigits(6);