Hi there,
It would be nice that bin labels get aligned with respect to their baseline (even if it’s still possible to handle this with white characters…).
{
TH1D * histo1 = new TH1D ("histo1","",2,0.,2.) ; histo1->GetXaxis()->SetBinLabel(1, "gam_prim" ) ; histo1->GetXaxis()->SetBinLabel(2, "gam_sec" ) ; histo1->SetStats(kFALSE) ; histo1->GetXaxis()->SetLabelSize(0.08) ; histo1->GetXaxis()->SetLabelOffset(0.015) ;
TH1D * histo2 = new TH1D ("histo2","",2,0.,2.) ; histo2->GetXaxis()->SetBinLabel(1," gam_prim ") ; histo2->GetXaxis()->SetBinLabel(2,"#color[0]{i}gam_sec ") ; histo2->SetStats(kFALSE) ; histo2->GetXaxis()->SetLabelSize(0.08) ; histo2->GetXaxis()->SetLabelOffset(0.015) ;
TCanvas * canvas = new TCanvas ("canvas","canvas",0,0,800,600) ; gStyle->SetPadTopMargin(0.15) ; gStyle->SetPadBottomMargin(0.15) ;
canvas->Divide(2,1) ;
canvas->cd(1) ; gPad->SetLeftMargin (0.20) ; gPad->SetRightMargin(0.05) ; histo1->Draw( ) ; TLine * line1 = new TLine ( 0.,-0.09, 3.,-0.09) ; line1->SetLineColor(kRed) ; line1->SetLineStyle(2) ; line1->Draw() ;
canvas->cd(2) ; gPad->SetLeftMargin (0.05) ; gPad->SetRightMargin(0.20) ; histo2->Draw("y+") ; TLine * line2 = new TLine (-1.,-0.09, 2.,-0.09) ; line2->SetLineColor(kRed) ; line2->SetLineStyle(2) ; line2->Draw() ;
}
Cheers,
Z