Running into the same issue for quite some time, I finally decided to post a thread here. My question is the following: is there a way to change the automatic labels of title, X and Y axis when plotting from a TTree?
To be more specific: when plotting one quantity versus another using TTree::Draw(“y : x”), the title and axis names are automatically set to the name of the quantities (here, y and x). But I don’t see any way of changing these names afterwards. I know how to change them in a TH1F or in a TGraph. But I don’t see how to do that directly from a TTree. I know that the TTree::Draw() command automatically produces a histogram called “htemp”, but I didn’t succeed to change it.
On the other hand, I succeeded to change the axis name by sending the output of the command to a histogram (TTree::Draw(“y : x>>hh”)), but this results in a histogram which has a “step-like” structure, i.e. does not look like the original TTree::Draw(“y : x”). So I am not satisfied with this solution.
Thank you for the answer. However this doesn’t solve the problem. Using these commands, I can change the labels, but all the points in the plot are gone…
Remove the last line “htemp->Draw()”, simply update your canvas.
The htemp histogram is only used to set the range, the real data being in a TGraph.
To see what you have in the pad, do
gPad->ls();