Dear ROOT developers,
I was trying to plot a histogram with a transparent TLegend in a TPad.
The problem is that the histogram was deleted when I drew the TLegend.
A simple code reproducing the bug is the following.
TH1F histo("histo","",100,-1,1);
histo.FillRandom("gaus",100);
TCanvas c1("c1","");
TPad pad1("pad1","",0.1,0.1,0.9,0.9);
pad1.Draw();
pad1.cd();
histo.Draw();
TLegend leg(0.7,0.7,0.85,0.85);
leg.AddEntry(&histo,"histo","l")
leg.SetFillStyle(4000)
leg.Draw();
Note that if you remove the pad1 definition, everything works properly.
Finally, I’ve found out that the problem was in “leg.SetFillStyle(4000)”. I had to use use “leg.SetFillStyle(0)” [1].
Even if I solved the problem, I think that this behaviour is a (minor) bug and so I wanted to report it to you.
Cheers,
Silvio.
[1] root.cern.ch/root/roottalk/roottalk03/1079.html
[2] root.cern.ch/doc/v608/classTAttFill.html