Automatic axis titles in TTree->Draw

Hi,

TTree->Draw("vary:varx")   makes a plot with "varx" and "vary" as axis titles.  That is a nice feature.

However, if I want to control the binning, TTree->Draw(“vary:varx>>(100,0.,1.,100,0.,1.)”) no longer has the axis titles. I can’t think of a reason why you wouldn’t also want the axis titles in this case - I certainly do.
Otherwise its an extra step to add the titles back in.

I hope this behavior can be changed - to always include the axis titles.

thanks, Aaron

Hi,
I agree, I am also missing this default behavior. My precompiled code cannot cope with the tree->Draw made from the commandline. The only possibility I see is the parsing a title somehow.

I think the logic behind this, is that when you plot Ntuple variables into an histogram, you do not want to change the histogram settings, like the titles. You can do:

 TH1D *h = new TH1D("h","h",100,0.,1.);
 h->GetXaxis()->SetTitle("bla");
 ntuple->Draw("px>>h");

or:

 TH1D *h = new TH1D("h","h;bla",100,0.,1.);
 ntuple->Draw("px>>h");

You can encapsulate this into a small function.