Hello ROOT experts,
I have a straightforward question - I think at least…
Basically, I need an axis to be automatically extendable for both TH1 and TH2 derivables (just X axis…) and I need this to behave the same way for both SetBinContent and Fills. I’ve read the docs for TH1, TAxis…etc…
Extendable for both the range and #bins… just x2…
I do set SetCanExtend of course…
However, here is what I observe:
— Fill - will behave as described in the documentation - extend the range and try to fit the value you are filling w/o increasing #bins. I’ve tried using LabelsInflate to double the #bins first before filling above max value… (just if up in front of Fill) and that makes #bins to double and the range to double as well. Which works well for what I need I think
— SetBinContent - will behave as well as described in docs - extend the axis by doubling the #bins and range as well - and that is what I need from the behavior.
However, for TH2:
— Fill - again the same - doubles the range, but LabelsInflate doesn’t work as in TH1 case - x axis.
It seems to double #bins and double the range, but somehow the way the histogram is filled doesn’t make sense.
— SetBinContent - basically I would expect the same behavior as in TH1 case - to extend the axis, however the axis doesn’t get extended…
I attach 2 scripts axis1D.py axis2D.py
1D - 2 histos are overlaid - to show that fill and set bin content do give the behavior as described
2D - 2 canvases - 1 for fill (h1 histo) and 1 for set bin content (h2).
I would think that extending axis and range should be quite a standard method - not sure how to achieve that for TH2… So the question is basically how to make it work for TH2???