Hi Micha,
Use SetTextSize(0) instead of SetTextSize(2.5)
A text size of 0 will force the automatic best size for the text.
Rene Brun
On Thu, 29 May 2003, Micha
D. Niskin wrote:
> Hello,
>
> I am using root 3.05/05, RedHat9 x86, gcc 3.2.2. I wish to create a
> TPaveStats in an existing histogram to display some other data, but I cannot
> seem to get the size right. Here is an example:
>
> I draw a TH1F and fill it with some random values. Then I get a pointer to the
> stats box with
>
> TPaveStats *stats = h1->GetListOfFunctions()->FindObject("stats")
>
> Then I create another stats box with the default constructor and make it a
> copy of the original one:
>
> TPaveStats *newstats = new TPaveStats;
> stats->Copy((TObject&) newstats);
> newstats->Draw("SAME");
>
> Now I have an empty stats box. However when I try to add some text,
>
> newstats->AddText("asdfasdf");
> newstats->Paint();
>
> the text comes out really, really tiny. So I tried to increase the size of the
> text:
>
> newstats->Clear();
> newstats->SetTextSize(2.5);
> newstats->AddText("asdfadsf");
> newstats->Paint();
>
> I get the same tiny text. I tried values between 0 and 1, and values on the
> order of 10, and some larger values (the deafult value appears to be 1). The
> odd thing is if I do this:
>
> newstats->Clear();
> newstats->SetTextSize(stats->GetTextSize());
> newstats->AddText("asdfasdf");
> newstats->Paint();
>
> I get nice sized text. I used stats->GetTextSize() in the interpreter to see
> what size the default histogram stats box was using but it said that the size
> was zero. Am I doing something wrong? Is there some toggle I have to set to
> be able to change the size of the text?
>
> Thank you in advance.
>
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET