I want to plot same histogram in one canvas such that the first part will show normal axes while the second one will show the same with log x including change in X axis label. I tried the following but it changed axes lable as per last line.
TFile* tf1 = new TFile("myFile.root"); TH2* myTH2 = (TH2*) tf1->Get("NeutronEnergy"); .... TCanvas* c1 = new TCanvas("c1", "myText", 1200, 800); c1->Divide(2,1); c1->cd(1); myTH2->SetMarkerStyle(7); myTH2->GetXaxis()->SetTitle("X Label"); myTH2->GetYaxis()->SetTile("Y Label"); myTH2->Draw(); c1->cd(2); myTH2->SetLogx(); myTH2->GetXaxis()->SetTitle("log10(X Label)"); // I want change here myTH2->GetYaxis()->SetTile("Y Label"); myTH2->Draw();
Please let me know how may I plot two plots of same histogram in divided canvas with two different axes labels.
Thank you very much for the technique that solved the issue. Can you kindly tell me how may I format y axis so that Y axis tic numbers will not superimpose on the y axis label? That means there will be some gap between y axis label and the y axis tics numbers?