I couldn’t find an answer to the problem of Franca which was posted some time ago (I added the thread at the end).
Is there a way now to add some custom text lines to a TPaveStats of an histogram?
Thanks for the answer!
Cheers,
Gerolf
Re: [ROOT] problem with TPaveStats::AddText in ROOT 3.04.02
From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jun 12 2003 - 22:09:32 MEST
* Next message: Rene Brun: "Re: [ROOT] Retrieve the formula expression from a TFormula"
* Previous message: Rene Brun: "Re: [ROOT] Embedding root"
* In reply to: Franca Cassol-Brunner: "[ROOT] problem with TPaveStats::AddText in ROOT 3.04.02"
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Franca,
What you do is in principle correct. However, the function
painting the stats box clears the stats box (including your added text)
before drawing it again with the latest histogram parameters.
I have to find a way to avoid this undesirable effect.
Rene Brun
On
Thu, 12 Jun
2003, Franca Cassol-Brunner wrote:
Hello,
I just moved to root 3.04.02 from root 3.02.07 and my
scripts don’t do anymore what they are supposed to do:
I want to add some lines to the TPaveStats of my histograms.
I read that now the stat belong to the histo and I do:
myHisto->Draw();
TPaveStats st =
(TPaveStats)histo1->GetListOfFunctions()->FindObject(“stats”);
st->AddText(“test”);
st->Print(); // print to be sure to have added the new line
st->SetX1NDC(0.3); // move the stat to be sure to re-draw it
st->SetX2NDC(0.6);
st->Draw();
The Print() functions shows that the new lines are in the stats,
but the when the stats is drawn, the new line are not drawn…
Even if I use the same procedure used for release 3.02.07 ( re-name the
stat and use TPaveStats* st= (TPaveStats*)gPad->GetPrimitive(“stats”) )
the new lines are not more drawn… What should I add miss
with the new release?
unfortunately I still have this problem,
I’m using TGraph and not TH1F, and solution you proposed does not work for me
For the timebeing I just added another TPaveText object with my additional text,
but would be nice to have it in the statistics box
In my case, I’d like to add a text line in the stats box as well, but I’m working with a THStack. I display two stats boxes as indicated here in the forth entry (I’m dealing with two histograms):
Then, I tried (h1_firCorrectionf1, h1_firCorrectionf2 are the histograms; st1, st2 are the TPaveStats intances from them):