Re: TGraph Title Size

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 31 2000 - 10:17:21 MEST


Hi Patrick,
Objects such as the histogram title or statistics box are generated on
the fly
when the histogram or TGraph is being drawn.

The default position, size of the title box and its content can be set
for all histograms via the TStyle control object. see functions:
  void  SetTitleColor(Int_t color=19)      {fTitleColor=color;}
  void  SetTitleTextColor(Int_t color=1)   {fTitleTextColor=color;}
  void  SetTitleStyle(Style_t style=1001)  {fTitleStyle=style;}
  void  SetTitleFont(Style_t font=62)      {fTitleFont=font;}
  void  SetTitleBorderSize(Width_t size=2) {fTitleBorderSize=size;}
  void  SetTitleX(Float_t x=0) {fTitleX=x;}
  void  SetTitleY(Float_t y=1) {fTitleY=y;}
  void  SetTitleW(Float_t w=0) {fTitleW=w;}
  void  SetTitleH(Float_t h=0) {fTitleH=h;}

For example, if you want to fix the length of the histogram title box
to cover 60 per cent along X of the pad, you can insert this statement
in your rootlogon.C file:
  gStyle->SetTitleW(0.6);

For a given histogram already in a pad, you can modify one of its
coordinates  via statements like:
   TPaveText *title = (TPavbeText*)gPad->GetPrimitive("title");
   title->SetX2NDC(0.6);
   gPad->Modified();

Interactively using the mouse, you can also grow/shrink/move the title
box.

Rene Brun

Patrick Dupre LCMI wrote:
> 
> Hello,
> 
> I was able to change the title of a TGraph (originally Graph), but I also
> would like to change the size of the font (and of the box arounding the title).
> This what I tried, but it does not work:
>   (TGraph) graph->SetTitle (filename) ;
>   TH1F *histo = graph->GetHistogram () ;
>   histo->SetTitleSize (0.025) ;
> --
> ---
> ==============================================================================
>    Patrick DUPRE                |   |   Tel:  (33 4) 76-88-78-51
>    CNRS/LCMI (GHMFL)            |   |   Fax:  (33 4) 76-85-56-10
>    25 Rue des Martyrs, BP 166   |   |   http://eschyle.polycnrs-gre.fr
>    F-38042 GRENOBLE Cedex 09    |   |   email: pdupre@polycnrs-gre.fr
> ==============================================================================



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:22 MET