I am using an old version of root (5.34/36) because I need a windows environment.
I had to reverse the axis of my TH2 graphs, therefore I successfully set a macro which creates TGaxis objects replacing the standard TH2 axis.
When I try to zoom in the final graph, the TGaxis move according to the zoom. I would like to anchor these two objects to the underlying TH2 or to give them an absolute position. Is it possible?
Here the piece of the code, taken from reverseaxis.C, which I found on this very forum.
gui_newCanvas(); reversedHist->Draw("COLZ"); //reversin the AXIS. It is just lable stuff, not organic reversing // Remove the current axis reversedHist->GetXaxis()->SetLabelOffset(999); reversedHist->GetXaxis()->SetTickLength(0); // Redraw the new axis gPad->Update(); TGaxis *newXaxis = new TGaxis(gPad->GetUxmax(), gPad->GetUymin(), gPad->GetUxmin(), gPad->GetUymin(), reversedHist->GetXaxis()->GetXmin(), reversedHist->GetXaxis()->GetXmax(), 510,"-"); newXaxis->SetTitle(original->GetXaxis()->GetTitle()); newXaxis->SetTitleSize(0.02); newXaxis->SetTitleOffset(1.5); newXaxis->SetLabelOffset(-0.03); newXaxis->SetLabelSize(0.03); newXaxis->Draw();
PS. is there a way to center the Lables respect to the axis?
Thank you for you time!
ROOT Version: 5.34/36
Platform: Windows 10