Hi,
I tried to reproduce the THStack example from the User’s Guide
Ignoring that there is an obvious pointer problem in the example, I can not all reproduce the given image at all!
My right image is identical, but the left one has obviously a wrong x axis, is not stacked and has no colors.
Any help is appreciated.
Andreas
ROOT: 4.00/08
OS: SuSE Linux 9.1
Code:
THStack *hs = new THStack(“hs”,“test stacked histograms”);
//create three 1-d histograms
TH1F *h1 = new TH1F(“h1”,“test hstack”,100,-4,4);
h1->FillRandom(“gaus”,20000);
h1->SetFillColor(kRed);
hs->Add(h1);
TH1F *h2 = new TH1F(“h2”,“test hstack”,100,-4,4);
h2->FillRandom(“gaus”,15000);
h2->SetFillColor(kBlue);
hs->Add(h2);
TH1F *h3 = new TH1F(“h3”,“test hstack”,100,-4,4);
h3->FillRandom(“gaus”,10000);
h3->SetFillColor(kGreen);
hs->Add(h3);
TCanvas *c1 = new TCanvas(“c1”,“stacked hists”,10,10,1000,800);
c1->Divide(2,1);
// in top left pad, draw the stack with defaults
c1->cd(1);
hs->Draw();
// in top right pad, draw the stack in non-stack mode and errors option
c1->cd(2);
hs->Draw(“nostack”);

