Re: [ROOT] different "col" palettes on the same pad

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 15 2002 - 23:44:34 MET


Hi Huw,

You can use the following trick using TExec.
When a TExec object is drawn, the action indicated is executed.
An example:

{
   TCanvas *c1 = new TCanvas("c1");
   TH2F *h1 = new TH2F("h1","h1",40,-4,4,40,-4,4);
   TH2F *h2 = new TH2F("h2","h2",40,-4,4,40,-4,4);
   Double_t a,b;
   for (Int_t i=0;i<5000;i++) {
      gRandom->Rannor(a,b);
      h1->Fill(a-1.5,b-1.5);
      h2->Fill(a+1.5,b+1.5);
   }
   TExec *ex1 = new TExec("ex1","gStyle->SetPalette(0);");
   TExec *ex2 = new TExec("ex2","gStyle->SetPalette(1);");
   h1->Draw("colz");
   ex1->Draw();
   h1->Draw("col same");
   ex2->Draw();
   h2->Draw("col same");
}
   

Rene Brun

On Wed, 13 Mar 2002, Huw Shorthouse wrote:

> Hello,
> 
> I want to draw different 2D histograms, with their own palettes, onto the
> same pad using the "col" option.  But because col always uses the current
> style, when the pad is updated all the histograms end up with the same
> palette and there is no way to distinguish them.  Is there any way at all
> around this.
> 
> Cheers,
> Huw
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:46 MET