I am making a histogram plot with ROOT and I am trying to edit its aesthetics. How can I make the tick marks on the plot point towards the negative direction while keeping the numbering and the title of the plot also below the x-axis?
From this link, SetTicks("-") can be used to invert the tick marks such that they point towards the negative direction. When I used it in my code for the x-axis, the plot runs as it should with the tick marks pointing towards the negative direction, however, the numbering and the title of the x-axis also inverts along with the tick marks, and both are shown above and inside the plot. This confuses me, as I thought that SetTicks() should only change the orientation of the tick marks, and not the title. I have also changed the placing of GetXaxis->SetTitle() to see if positioning matters in the code, but it seems as if it does not. (Note: everything in the code has already been predefined.)
for (unsigned int i = 0; i < Nhistos; i++) {
fexpmentname[i] = new TFile(Form("total/nuifo_%s.root",expmentname[i].c_str()), "read");
hnumu[i] = (TH1D*)fexpmentname[i]->Get("flux/hflux_numu");
hnumu[i]->SetStats(0);
hnumu[i]->SetLineColor(color[i]);
leg->AddEntry(hnumu[i], Form("%s", lexpmentname[i].c_str()), "l");
if (i == 0) {
hnumu[i]->GetXaxis()->SetTitle("Neutrino energy (GeV)");
hnumu[i]->GetYaxis()->SetTitle("# #nu_{#mu} neutrino flux (#nu_{#mu} / m^{2} / GeV / 2.5 x 10^{8} POT)");
hnumu[i]->GetYaxis()->SetTickLength(0);
hnumu[i]->GetXaxis()->SetTicks("-");
hnumu[i]->GetXaxis()->SetTickLength(0.015);
hnumu[i]->SetTitle("#nu_{#mu} Fluxes at Various Experiments");
hnumu[i]->Draw();
}
else{
hnumu[i]->Draw("same");
}
}
Again, I expected the output to be such that the tick marks, numbering, and title of the x-axis be below the x-axis, but only the tick marks are. I have no current explanation for this.
After a bunch of experimentation, I figured out the answer to my own question. All you have to do is to simply set a negative tick length and get rid of the SetTicks("-"):
hnumu[i]->GetXaxis()->SetTickLength(-0.015);