THStack draw option with shaded line

Dear friends,

I have one problem to draw stacked histogram.

First, I have three histograms to be stacked, it is needed to be regarded as one histogram after stacked.
And I would like to fill it using shaded lines.

{
THStack *hs = new THStack(“hs”,"");

TH1F *h1 = new TH1F(“h1”,"",100,-5,5);
TH1F *h2 = new TH1F(“h2”,"",100,-5,5);
TH1F *h3 = new TH1F(“h3”,"",100,-5,5);

h1->FillRandom(“gaus”,10000);
h2->FillRandom(“gaus”,20000);
h3->FillRandom(“gaus”,10000);

//
TCanvas *c1 = new TCanvas(“c1”,“stacked hists”,0,0,400,400);
c1->SetFillColor(10);

h1->SetFillStyle(3005);
h2->SetFillStyle(3005);
h3->SetFillStyle(3005);

h1->SetFillColor(1);
h2->SetFillColor(1);
h3->SetFillColor(1);

//
hs->Add(h1);
hs->Add(h2);
hs->Add(h3);

//
hs->Draw();

}

The resultsing figure is as attached “stack.png”.

However as I mentioned first, for my case, this stacked histogram needs to be regarded as one histogram,
so I tried to remove lines for h1 and h2, by putting like

// opt?
h1->SetLineColor(0);
h2->SetLineColor(0);

,then, it appears as

where the white discrepancies happened.

Can I have better smooth(?) figure from stacked histogram?

Thanks in advance,

If you want the 3 histograms regarded as one histogram you should sum them in a 4th one and plot this 4th histogram. No need to use stacks in that case.

Hi, Couet

Thanks for comments.
Actually, the full story is more complicated, but your comment is a key to solve my problems by using adding and stacking histograms repeatedly.

Sometimes, I’m screwed up with the basic. :slight_smile: