ROOT Version: 6.12/06 Platform: macOS Compiler: Not Provided
I’m trying controlling a histogram x axis digit numbers through hist->GetXaxis()->SetMaxDigits() or TGaxis gx = (TGaxis)hist->GetXaxis();gx->SetMaxDigits(); but only y axis takes effect even I get the x axis. Any way to set x axis digit number?
For example, I want to set the x axis 1.4 \times 10^-5 instead of 14 \times 10^-6 dyStats.pdf (14.4 KB)
I try this, but it still works only for y axis not for x axis. Maybe it’s because I use root 6.12/06 version but you use root 6.14.00(which I noticed from your post)?
Anyway, I provide the data and the script to produce the graph, which makes your help more direct and convenient. Thank you. dyStats.cpp (3.1 KB) dyStats.root (54.6 KB)
Yes, that’s what I get too. I want to get x axis with order 10^-5 instead of 10^-6. That’s I’m trying to set the max digit of x axis. It’s the right way to get this by setting x axis max digit number?
Ok I simplified your macro to concentrate only on the axis topic. I ended up with this:
void dyStats(){
TCanvas *cc = new TCanvas("cc","cc",1000,600);
auto f = new TFile("dyStats.root");
auto cross = new TH1F("cross","cross",100,1.4e-5,1.57e-5);
TTree* cs = (TTree*)f->Get("dyStats");
cs->Draw("crossSection>>cross");
cross->SetXTitle("cross section(mb)");
cross->GetXaxis()->SetMaxDigits(7);
cross->GetYaxis()->SetMaxDigits(1);
}
I gave more freedom on the X axis (7 digits so the exponent disappeared) and less on the Y axis (only one digits so the exponent appear). The important thing to notice is that you are able to act on both axis independently .
I am afraid you did not get the basics of my post:
The implemented algorithm c a n n o t produce
exponents like : 10-5, 10-2
only 10-3, 10-6, 10-9 etc
for whatever axis