Draw and illegal ranges


Apparently, when trying to draw a variable from a tree and output it to a histogram, as so:

f = TFile("myfile.root","r")
t = f.Get("myTree")
h = TH2F("h","",xbins,xmin,xmax,ybins,ymin,ymax)

in the special case ymin=ymax, the command h.Draw("axis") reports illegal ranges but h.Draw() doesn’t. Instead, h.Draw() rebins the data, keeping the same ybins but massaging the Y range for a “nice” plot.

Is that on purpose?

Search for “automatic bin” in the TH1 class description

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.