Re: [ROOT] TProfile2D and COLZ draw option

From: Eric Thomas (ethomas@cppm.in2p3.fr)
Date: Thu Jul 17 2003 - 18:09:55 MEST


Hi Olivier,

I tried your example and I am still puzzled by the matching between
the bin content and the color code. I slightly modified your example
for better reading of the output (I modified the binning and I superimposed
the bin content on the plot). You can see the output at:

http://marwww.in2p3.fr/~ethomas/couet/couet.gif


For example you can see the the most upper right bin is yellow, while
I expected it to be orange, according to my understanding of the color panel.


Here is copy/paste of the code I used to produce the plot.

{
  TCanvas *c1 = new TCanvas("c1","Profile histogram example",200,10,700,500);
  hprof2d  = new TProfile2D("hprof2d","Profile of pz versus px and py",10,-4,4,10,-4,4,0,20);
  Float_t px, py, pz;
    for ( Int_t i=0; i<25000; i++) {
     gRandom->Rannor(px,py);
     pz = px*px + py*py;
     hprof2d->Fill(px,py,pz,1);
    }
  gStyle->SetOptStat(0);
  gStyle->SetPalette(1);
  hprof2d->SetContour(10);
  hprof2d->Draw("COLZ");
  hprof2d->Draw("TEXT" "SAME");
}


Let me know if the output make sense.

Thanks for your help,

Eric


Olivier Couet wrote:

> Hi Eric,
>
> I have tried to reproduce your problem with ROOT 3.05/05 on linux, but for
> me it works fine. I used the following example:
>
> {
>   TCanvas *c1 = new TCanvas("c1","Profile histogram example",200,10,700,500);
>   hprof2d  = new TProfile2D("hprof2d","Profile of pz versus px and py",40,-4,4,40,-4,4,0,20);
>   Float_t px, py, pz;
>   for ( Int_t i=0; i<25000; i++) {
>      gRandom->Rannor(px,py);
>      pz = px*px + py*py;
>      hprof2d->Fill(px,py,pz,1);
>   }
>   hprof2d->Draw("COLZ");
> }
>
> Let me know.
>
>  Cheers,            Olivier
>
> On Wed, 16 Jul 2003, Eric Thomas wrote:
>
> > Hi All,
> >
> >
> > Does the following command
> >
> > h440->Draw("COLZ");
> >
> > works properly in case h440 is a TProfile2D?
> > I am wondering because the displayed colors doesn't match the
> > panel's color code and the bin content.
> > I am using root 3.05/00.
> >
> > Thanks for the help,
> >
> > Eric
> >
> >
>
> --
> Org:    CERN - European Laboratory for Particle Physics.
> Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910
> E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
> WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET