Automatic handling of misplaced axis title

I often encounter the problem that by default my axis title is covering by the axis labels or is cut by the margin. Is there a way to handle that more gracefully, and in an automatic way? I am aware of the methods SetTitleOffset and SetPadLeftMargin and the like, but I was wondering if there were a way to retrieve enough information to properly position the title once the plot has been drawn, something like (for a y-axis label)

  1. Get the leftmost label character
  2. Add an offset so that the title is far enough from the labels
  3. Redefine left margin so that 1)+2) falls within the margin limit
  4. Add title

I think it is essentially 1) That I do not know how to handle.

There is no way to do it as you are asking. But if your histogram always need more space on the left margin, for instance, you can do a global set using gStyle->SetPadLeftMargin().