I have a hopefully simple question. I use gStyle->SetPaintTextFormat(“4.1f”); to define the number of significant figures when plotting with the option “text”. I see that I can add some units by using:
gStyle->SetPaintTextFormat(“4.1f m”);
My question is, can I add text as a prefix to the bin content? Meaning, to plot the histograms entries as:
“myText BinContent"
instead of
"BinContent myText”
I tried:
gStyle->SetPaintTextFormat(“A 4.1f”);
and it does something odd…
As you see a “%” is put in front of the string. So it is assumed that the string start with the format and can be followed by some text which can be seen as “units”… We can change the behavior but we take the risk to be backward incompatible.
If we allow text before the format then the % will be needed for the format ie:
gStyle->SetPaintTextFormat("Some text before %4.1f some text after");
Thanks for the fast reply. This is for a one-time only histogram, so I don’t dare request any change in the format. I’ll try to find an alternative option. Just wanted to check it was not possible as it is…