Re: [ROOT] Pads sharing the same Xaxis : problem for scaling text.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jan 19 2001 - 17:59:18 MET


Sorry, I sent the wrong file for the example with font size given in pixels.
In the example given, you should remove the line t.SetNDC().

Rene Brun

Rene Brun wrote:
> 
> Hi Yannick,
> 
> If you use version 3.00/02 available since yesterday, you can specify
> a font size in pixels. See short example below.
> The font must be precision=3 (eg 53)
> see:  http://root.cern.ch/root/htmldoc/TAttText.html
> 
> {
>    TCanvas *c1 = new TCanvas("c1","c1",600,800);
>    c1->Divide(1,3);
>    TFile *f = new TFile("hsimple.root"); //file produced in tutorials
>    TText t;
>    t.SetTextColor(4);
>    t.SetTextFont(53); //with precision 3, text size is specified in pixels
>    t.SetTextSize(20);
>    t.SetTextAlign(22);
>    //t.SetNDC();  <====remove this line
>    c1->cd(1);
>    hpx->Draw();
>    t.DrawText(0,500,"First Text");
>    c1->cd(2);
>    hprof->Draw();
>    t.DrawText(0,10,"Second Text");
>    c1->cd(3);
>    hpxpy->Draw();
>    t.DrawText(0,2,"Third Text");
>    c1->cd(0);
> }
> 
> Rene Brun
> 
> Patois Yannick wrote:
> >
> > Hi rooters,
> >
> > I use a custom routine to create pads in one raw, with only one
> > scale at the bottom, like:
> >
> > .---------.
> > |  Pad 3  |
> > |         |
> >  ---------
> > |  Pad 2  |
> > |         |
> >  ---------
> > |  Pad 1  |
> > |         |
> > |,-,-,-,-,| <- Scale
> > `---------'
> >
> > I found out that the Pad labeled Pad1 couldnt be the same size as the 2
> > other because it had to allow space for the axis label and title, so if
> > I want an identic frame size, pads cant be the same.
> > So I dont use TPad::Divide, but I create my pad one by one.
> >
> > I works.
> >
> > But a problem arise when I try to write some text into each pad :
> >
> > The text in Pad1 is *bigger* than the one in the others, simply because
> > it get automatically scaled relatively to the pad size.
> >
> > I dont really know what I can do, either I'm wrong and pads could be
> > made the same size somehow, or maybe there is a simple way to 'rescale'
> > things I wrote in a pad independantly of the pad's size.
> >
> > For now, I just set the size of the writing a little bit differently for
> > the first pad, maybe there is a very simple way to deduce the scaling
> > factor according to the pad size and correct it ?
> >
> > Could anyone help me ?
> >
> >         Yannick



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:50:55 MEST