RE: THStack, gROOT->SetStyle("Plain") and CreateGradientColorTable

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Thu, 25 Mar 2010 17:16:25 +0100


Good :-)

-----Original Message-----
From: Andrea Massironi
Sent: Thursday, March 25, 2010 5:09 PM
To: Olivier Couet; roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: RE: [ROOT] THStack, gROOT->SetStyle("Plain") and CreateGradientColorTable

Thank you very much!
Everything works

thanks, Andrea

-----Original Message-----
From: Olivier Couet
Sent: Thu 3/25/2010 2:59 PM
To: Andrea Massironi; roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: RE: [ROOT] THStack, gROOT->SetStyle("Plain") and CreateGradientColorTable

Hi Andrea,
The issue with the Y axis zooming is now fixed in the SVN trunk Thanks for reporting.
Olivier

-----Original Message-----
From: Andrea Massironi
Sent: Wednesday, March 24, 2010 5:35 PM
To: Olivier Couet; roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: RE: [ROOT] THStack, gROOT->SetStyle("Plain") and CreateGradientColorTable

I'm not sure, but I think it was present also in previous versions.

I svn co the last SVN following [1]
svn co https://root.cern.ch/svn/root/trunk root

    ROOT 5.27/01 (trunk_at_32730, Mar 24 2010, 15:50:20 on linux) If I try to run the same macro as before, I still get the same problem. And in addition I can't zoom on the "y" axis.

Am I wrong somewhere?

Thanks, Andrea

[1] http://root.cern.ch/drupal/content/subversion-howto

-----Original Message-----
From: Olivier Couet
Sent: Wed 3/24/2010 12:42 PM
To: Andrea Massironi; roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: RE: [ROOT] THStack, gROOT->SetStyle("Plain") and CreateGradientColorTable

Hi Andrea,
This is now fixed in the SVN trunk.
Thanks for reporting it.
Olivier

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Andrea Massironi Sent: Wednesday, March 24, 2010 11:07 AM To: roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: [ROOT] THStack, gROOT->SetStyle("Plain") and CreateGradientColorTable

Dear Rooters,

   I'm using THStack and I get a strange behaviour. Running the attached macro I get the stacked histogram image with colours somehow mixed.
The problem doesn't show up if I remove

     gROOT->SetStyle("Plain");

or if I set the "nb" less than 77

    Int_t nb = 77

of if I do not set at all "CreateGradientColorTable"

    TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);

Did I miss something?

Thanks, Andrea

    {

     gROOT->Reset();
     gROOT->SetStyle("Plain");

     UInt_t Number = 3;
     Double_t Red[Number]    = { 1.00, 0.00, 0.00};
     Double_t Green[Number]  = { 0.00, 1.00, 0.00};
     Double_t Blue[Number]   = { 1.00, 0.00, 1.00};
     Double_t Length[Number] = { 0.00, 0.50, 1.00 };
     Int_t nb = 77; //---- 76 is ok ---- 77 NO ----
     TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);


     TCanvas *c1 = new TCanvas("c1","c1",800,600);


//-------------------------------------------
TH1F *h1 = new TH1F("h1","Histo 1",100,-5,5); h1->FillRandom("gaus",10000); TH1F *h2 = new TH1F("h2","Histo 2",100,-5,5); h2->FillRandom("gaus",10000); TH1F *h3 = new TH1F("h3","Histo 3",100,-5,5);
    h3->FillRandom("gaus",10000);

//-------------------------------------------

//-------------------------------------------

     h1->SetFillStyle(3004);
     h1->SetFillColor(1);

     h2->SetFillStyle(3008);
     h2->SetFillColor(2);

     h3->SetFillStyle(3004);
     h3->SetFillColor(3);


//-------------------------------------------
THStack *hs = new THStack("hs","A stack of histograms"); hs->Add(h1); hs->Add(h2); hs->Add(h3);
//-------------------------------------------
TLegend *leg = new TLegend(0.1,0.6,0.4,0.9); leg->AddEntry(h1,"h1","f"); leg->AddEntry(h2,"h2","f"); leg->AddEntry(h3,"h3","f");
//-------------------------------------------
hs->SetTitle("THStack::Draw()"); hs->DrawClone(); leg->DrawClone();

    } Received on Thu Mar 25 2010 - 17:16:29 CET

This archive was generated by hypermail 2.2.0 : Thu Mar 25 2010 - 23:50:01 CET