TH2F TStyle problem?

Dear Rooters,

Heres’s my problem. I have a 2 pad canvas. On the first pad I plot a TH2F with its StatBox and with a Palette(1). On the second I plot another TH2F with no StatBox and the default Palette. Everything works fine as soon as I do not save my canvas as a eps, ps, or pdf file. If I do so, the style disappears and I end up with two histograms with no StatBox and the default Palette on my screen and in my eps/ps/pdf file. Weirdly enough, this does not happen with gif files.

This problem does not occur with TH1F: whatever the format I use to save my canvas, the style’s conserved.

I’m using ROOT 4.03/02 under Cygwin.

Below’s my code,
Thanks for your help,
Zesp

{

gROOT->Reset() ;

TH2F* h1  = new TH2F ("h1" ,"", 15,-5.,+5., 15,-5.,+5.) ;
TH2F* h2  = new TH2F ("h2" ,"", 15,-5.,+5., 15,-5.,+5.) ;

h1->FillRandom("gaus",1000) ;
h2->FillRandom("gaus",1000) ;
	
//////

TCanvas *c1 = new TCanvas ("c1","c1", 10,10, 600,300) ;
c1->Divide(2,1) ;

TStyle *MyStyle1 = new TStyle ("MyStyle1","My Style 1") ;
MyStyle1->SetOptStat(1111) ;
MyStyle1->SetPalette(1) ;
gROOT->SetStyle("MyStyle1") ;
c1->cd(1) ; h1->Draw("COLZ") ;

TStyle *MyStyle2 = new TStyle ("MyStyle2","My Style 2") ;
MyStyle2->SetOptStat(0) ;
gROOT->SetStyle("MyStyle2") ;
c1->cd(2) ; h2->Draw("COLZ") ;

c1->cd() ;
//c1->SaveAs("bidim.eps") ;

}

It is not problem with PS or PDF. Resize the Pad (enlarge it with the mouse) and you will see that the two plots use the same pallette. ROOT has only one color palette. That’s why you get this.

OK, thanks for the tip (even though it works with gif files) and
let’s forget this Palette problem. It’s not the big deal after all.

What really annoys me is not to be able to have :

  • one histogram with its StatBox on one pad, and
  • the other histogram on the second pad without its StatBox.
    Here’s my new code. Cannot it be a plain gStyle problem ?

Cheers, M@

{

gROOT->Reset() ;

TH2F* h1  = new TH2F ("h1" ,"", 15,-5.,+5., 15,-5.,+5.) ;
TH2F* h2  = new TH2F ("h2" ,"", 15,-5.,+5., 15,-5.,+5.) ;

h1->FillRandom("gaus",1000) ;
h2->FillRandom("gaus",1000) ;
   
//////

TCanvas *c1 = new TCanvas ("c1","c1", 10,10, 600,300) ;
c1->Divide(2,1) ;

TStyle *MyStyle1 = new TStyle ("MyStyle1","My Style 1") ;
MyStyle1->SetOptStat(1111) ;
gROOT->SetStyle("MyStyle1") ;
c1->cd(1) ; h1->Draw("COLZ") ;

TStyle *MyStyle2 = new TStyle ("MyStyle2","My Style 2") ;
MyStyle1->SetOptStat(0) ;
gROOT->SetStyle("MyStyle2") ;
c1->cd(2) ; h2->Draw("COLZ") ;

c1->cd() ;

}
{
   TH2F* h1  = new TH2F ("h1" ,"", 15,-5.,+5., 15,-5.,+5.) ;
   TH2F* h2  = new TH2F ("h2" ,"", 15,-5.,+5., 15,-5.,+5.) ;
                                                                                
   h1->FillRandom("gaus",1000) ;
   h2->FillRandom("gaus",1000) ;
                                                                                
   TCanvas *c1 = new TCanvas ("c1","c1", 10,10, 600,300) ;
   c1->Divide(2,1) ;
                                                                                
   TStyle *MyStyle1 = new TStyle ("MyStyle1","My Style 1") ;
   MyStyle1->SetOptStat(1111) ;
   gROOT->SetStyle("MyStyle1") ;
                                                                                
   h1->SetStats(kFALSE);
   c1->cd(1) ; h1->Draw("COLZ") ;
                                                                                
   c1->cd(2) ; h2->Draw("COLZ") ;
}

Yeah sure ! I’m sorry, it was a stupid question.
Thanks for your time and consideration,
Zesp