I would like to propose that two methods are added to the TAxis class: FixedToVariable and VariableToFixed.
So, an axis which was created as a “fixed bin sizes” one could be converted into a “variable bin sizes” one and the opposite.
Note: in case of the “VariableToFixed” method, we would not preserve bin widths, only the “low-edge”, the “upper-edge” and the number of bins would be used / preserved.
I guess I would like to have:
FixedToVariable(Double_t *xbins = 0)
FixedToVariable(Double_t xmin = 0., Double_t xmax = 0.)
VariableToFixed(Double_t xmin = 0., Double_t xmax = 0.)
If the user provides “xbins” or “xmin < xmax” then use them when calculating new bin edges / limits, otherwise calculate bin edges using the existing “low-edge” and “upper-edge” of the axis.
I don’t have any preference for what these methods should return, so maybe “void
” is a good choice (or maybe better the “this
” pointer).
Moreover, I think I would also like to propose that a “fixed bin sizes” axis is automatically converted into a “variable bin sizes” one as soon as the user calls “TAxis::GetXbins()
” (which usually means that the user will want to get its “bin edges array” right away).
BTW. maybe you could also think about adding a “Scale” method: