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

From: Nicolas Arnaud <narnaud_at_lal.in2p3.fr>
Date: Mon, 08 May 2006 16:47:41 -0700

Hi,

I'm wondering how to display properly bins with 0 or negative contents when plotting a TH2 histogram with the "colz" option.

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");
} Received on Tue May 09 2006 - 01:46:28 MEST

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