def fixXExponent(self, canvas): ''' If there's an exponent on the Y axis, it will either be in a weird place or it will overlap with the axis title. We fix the placement in __init__(), but we still have to move the title if need be. Recursive, so we find histograms in pads in pads. ''' for obj in canvas.GetListOfPrimitives(): if obj.InheritsFrom(TH1.Class()) or obj.InheritsFrom( THStack.Class()): axis = obj.GetXaxis() if axis.GetXmax() >= 10**TGaxis.GetMaxDigits(): # has exponent axis.CenterTitle() if obj.InheritsFrom(TPad.Class()): self.fixXExponent(obj)