Re: Strange behaviour of TLegend

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Mar 08 2000 - 15:27:35 MET


Hi Colin,
There is an interference between the FillStyle with the special patterns
and the contradiction of setting gStyle->SetFillColor(0), then setting
h->setFillColor(1).
I suggest to change your example in the following way:

There are still several problems with the special fill patterns (screen
,ps).
I hope to have some time to fix this in the next release.

Rene Brun

{
gROOT->Reset();
gROOT->SetStyle("Plain");
//gStyle->SetFillColor(0);

TH1F *h=new TH1F("h"," ",5,0,5);

h->SetFillStyle(3004);
h->SetFillColor(16);

h->Fill(3);
h->Draw();

TLegend *leg=new TLegend(0.2,0.2,0.4,0.26);
leg->SetTextSize(0.05);
leg->AddEntry(h," test","f");
leg->Draw();
}  


C. Bernet wrote:
> 
> Hello,
> 
> I can't make TLegend work correctly : When I create an entry for an
> histogram with "f" option, I get a box with a thick vertical line in the
> middle, wich doesn't look at all like the plot. Does anybody experiences
> this kind of problem with this tool (which would in principle be so
> useful) ?
> 
> I'm using root 2.23/12 with RedHat 5.1 and here is an example macro :
> 
> {
> gROOT->Reset();
> gROOT->SetStyle("Plain");
> gStyle->SetFillColor(0);
> 
> TH1F *h=new TH1F("h"," ",5,0,5);
> 
> h->SetFillStyle(3004);
> h->SetFillColor(1);
> 
> h->Fill(3);
> h->Draw();
> 
> TLegend *leg=new TLegend(0.2,0.2,0.4,0.4);
> leg->AddEntry(h,"test","f");
> leg->Draw();
> }
> 
> Thanks,
>                 Colin



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET