Change of Text font size etc

Hi,

In a histogram, I want to change the title Text Font Size and Color without using the menu, i.e implementing these changes directly in my macro. Looking at the User’s guide I tried the following:

 htac1->Draw() ;
 TPaveText *pvttac1= (TPaveText*)htac1->GetListOfFunctions()->FindObject("title") ;
 pvttac1->SetTextColor(2) ;
  htac1->Draw() ;

Something is wrong in the third line because I’ve got the message:

So what are the instructions allowing to change the text font, size or color from a TPaveText ?

Thanks a lot,

                   Thomas

do

gPad->Update();

after:

htac1->Draw() ;

I have the same error message with

 htac1->Draw() ;

  TPaveText *pvttac1= (TPaveText*)htac1->GetListOfFunctions()->FindObject("title") ;
  pvttac1->SetTextColor(2) ;
  
  htac1->Draw() ;
  gPad->Update() ;

or


 htac1->Draw() ;
  gPad->Update() ;

  TPaveText *pvttac1= (TPaveText*)htac1->GetListOfFunctions()->FindObject("title") ;
  
  htac1->Draw() ;

pvttac1->SetTextColor(2) ; is not correct ? (TPaveText inherits from AttText , right ? So I suppose I can use functions defined in the AttText class …)

pvttac1 is not defined … this pointer is null

better do:

root [0] gStyle->SetTitleTextColor(2)
root [1] hpx->Draw()

Thanks ! I have a look in the TStyle function list.

At the beginning of my macro I defined the details for the style:

gStyle->SetPalette(1) ;
 gStyle->SetTextFont(22) ;
 gStyle->SetTitleFont(22,"xyz") ;
 gStyle->SetTitleFont(22,"a") ;
 gStyle->SetLabelFont(22,"xyz") ;

And it works !