THStack overlay: opaque distributions

What you see is that class “feature”. Here you are the piece of the THStack::Paint(Option_t *option) method that explains your observation. Pay your attention to the hardcoded:

h1->SetFillColor(1000); h1->SetFillStyle(1001); h1->Paint(loption);

for (Int_t i=0;i<nhists;i++) { if (strstr(lnk->GetOption(),"same")) { sprintf(loption,"%s%s",noption,lnk->GetOption()); } else { sprintf(loption,"%ssame%s",noption,lnk->GetOption()); } h1 = (TH1*)fStack->At(nhists-i-1); if (i>0) { // Erase before drawing the histogram h1col = h1->GetFillColor(); h1fill = h1->GetFillStyle(); h1->SetFillColor(1000); h1->SetFillStyle(1001); h1->Paint(loption); static TClassRef clTFrame = TClass::GetClass("TFrame",kFALSE); TAttFill *frameFill = (TAttFill*)clTFrame->DynamicCast(TAttFill::Class(),gPad->GetFrame()); h1->SetFillColor(frameFill->GetFillColor()); h1->SetFillStyle(frameFill->GetFillStyle()); h1->Paint(loption); h1->SetFillColor(h1col); h1->SetFillStyle(h1fill); } h1->Paint(loption); lnk = (TObjOptLink*)lnk->Prev(); } I slightly changed your macro (see attachment) and re-run it with the QtRoot plugin (see the thread Transparent histogram fill style for some details)




THStackOverlay.hash.C (2.09 KB)
THStackOverlay.4.QtRoot.C (2.04 KB)