Hi,
For some reason I do not understand yet the background of the red hatches are drawn with solid blue. This is visible on PS and PDF too which are completely different way of drawing. With the option "nostack" the problem does not show.
I have one question: is it some new problem you noticed with a recent root version ? does it appeared recently and was not present in older version ?
Cheers,
I am investigating.
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);h3->FillRandom("gaus",10000);
//-------------------------------------------
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);
//-------------------------------------------
//-------------------------------------------
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();
This archive was generated by hypermail 2.2.0 : Wed Mar 24 2010 - 17:50:01 CET