Re: Color of zero or negative bins when drawing a TH2 histogram with the colz option

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Wed, 10 May 2006 10:22:29 +0200 (CEST)

Hi,

 The problem you mentionned as 'option 3' in now fixed in the CVS head. Thanks to have reported it.

 Olivier

On Mon, 8 May 2006, Nicolas Arnaud wrote:

>
> Hi,
>
> I'm wondering how to display properly bins with 0 or negative contents when
> plotting a TH2 histogram with the "colz" option.
>
> * Executing test.cc as it is ('option 1') works as expected.
>
> * With 'option 2' the bin with 0 content is displayed white instead of purple
> which is weird: the bin with the highest content (100) is properly displayed
> in red.
>
> * With 'option 3' (one bin with negative content), the colors get screwed up.
>
> I have the same results with two different versions of root: 4.01/02 or
> 5.08/00.
>
> Thanks in advance for your help,
>
> Nicolas
>
> ----------------------------------------------------------
>
> void test()
> {
> gROOT->Reset();
>
> TH2F* histo = new TH2F( "histo", "histo", 3, 0.0, 3.0, 2, 0.0, 2.0 );
>
> Int_t dummy;
>
> dummy = histo->GetBin( 1, 1 );
> histo->SetBinContent( dummy, 1.0E-20 ); // option 1
> //histo->SetBinContent( dummy, 0.0 ); // option 2
> //histo->SetBinContent( dummy, -1.0 ); // option 2
> dummy = histo->GetBin( 2, 1 );
> histo->SetBinContent( dummy, 1.0 );
> dummy = histo->GetBin( 3, 1 );
> histo->SetBinContent( dummy, 10.0 );
> dummy = histo->GetBin( 1, 2 );
> histo->SetBinContent( dummy, 20.0 );
> dummy = histo->GetBin( 2, 2 );
> histo->SetBinContent( dummy, 50.0 );
> dummy = histo->GetBin( 3, 2 );
> histo->SetBinContent( dummy, 100.0 );
>
> gStyle->SetPalette( 1, 0 );
> histo->Draw("colz");
> }
>
>
>

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7670300
Received on Wed May 10 2006 - 10:22:37 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET