Hi,
I tried the option TGaxis::SetMaxDigits(2) in one of my TH2F histograms to get rid of the extra digits on the axis labels, it worked but then the color palette was also changed and it now looks funny, is there an option to do the above for the axis labels only.
Also the numbers on the Palette don’t appar all the time, I tried to resize the canva but it didn’t work.
I attache two files, one before the TGaxis being added and one after, I also attach the script.
{
TFile *f1 = new TFile(“histograms_Qs.root”,“READ”);
TCanvas *dtest = new TCanvas(“dtest”,“dtest”,1000,800);
dtest->Divide(2,2,.01,.01);
hAX4nb2PE_P->SetStats(kFALSE);
hAX4nb2PE_Data->SetStats(kFALSE);
//hAX4nb2PE_P->GetXaxis()->SetTitleSize(0.05);
//hAX4nb2PE_Data->GetXaxis()->SetTitleSize(0.05);
//hAX4nb2PE_P->GetYaxis()->SetTitleSize(0.05);
//hAX4nb2PE_Data->GetYaxis()->SetTitleSize(0.05);
hAX4nb2PE_P->GetXaxis()->SetTitle(“CX2 = (nb2/cxPE)”);
hAX4nb2PE_Data->GetXaxis()->SetTitle(“CX2 = (nb2/cxPE)”);
hAX4nb2PE_P->GetYaxis()->SetTitle(“AX4P = (nOut+nTop)*nFit/cxPE”);
hAX4nb2PE_Data->GetYaxis()->SetTitle(“AX4P = (nOut+nTop)*nFit/cxPE”);
hAX4nb2PE_P->GetXaxis()->SetRange(0,60);
hAX4nb2PE_Data->GetXaxis()->SetRange(0,60);
hAX4nb2PE_P->GetYaxis()->SetRange(0,60);
hAX4nb2PE_Data->GetYaxis()->SetRange(0,60);
hAX4nb2PE_P->SetTitle(“Proton MC”);
hAX4nb2PE_Data->SetTitle(“Data”);
//Normailze the histograms
Double_t scale_P = 1.0/hAX4nb2PE_P->Integral();
hAX4nb2PE_P->Scale(scale_P);
Double_t scale_D = 1.0/hAX4nb2PE_Data->Integral();
hAX4nb2PE_Data->Scale(scale_D);
dtest->cd(1);
TGaxis::SetMaxDigits(2);
hAX4nb2PE_P->SetMinimum(1.e-6);
hAX4nb2PE_P->Draw(“colz”);
dtest->cd(2);
gPad->SetLogz();
hAX4nb2PE_P->Draw(“colz”);
dtest->cd(3);
hAX4nb2PE_Data->SetMinimum(1.e-6);
hAX4nb2PE_Data->Draw(“colz”);
dtest->cd(4);
gPad->SetLogz();
hAX4nb2PE_Data->Draw(“colz”);
}
P_D_Dist_After.ps (119 KB)
P_D_Dist_before.ps (117 KB)