Re: [ROOT] legend for datapoints in 1 ntuple??

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Feb 20 2001 - 19:29:02 MET


Hi Niels,
Your TLegend has two references to the SAME object. When drawing the legend,
the current attributes of the object will be taken.
You should specify two different objects (histograms generated by TTree::Draw)
rather than the ntuple1 object.

Rene Brun

Niels van Bakel wrote:
> 
> Hi,
> 
> I plot 5 sets of datapoints stored in 1 ntuple, these sets of datapoints
> have different markers and colors. My problem is to get a legend which
> contains the 5 different markers?? I get only the last marker I used
> (markerstyle 29 and not markerstyle 5), see below.
> How do I solve this??
> 
> Thanks, Niels
> 
> c1->cd(1);
> c1->DrawFrame(0,0,0.16,0.4e-3);
> leg = new TLegend(0.4,0.8,0.89,0.89);
> leg->SetTextSize(0.03);
> ntuple1->SetMarkerStyle(5);
> ntuple1->SetMarkerColor(4);
> ntuple1->Draw("zovern:sigma","((ddr==0.001) && (ddz==0.001) &&
> (ubt==0.1))","same");
> leg->AddEntry(ntuple1,"ubt=0.1","P");
> leg->Draw();
> ntuple1->SetMarkerStyle(25);
> ntuple1->SetMarkerColor(6);
> ntuple1->Draw("zovern:sigma","((ddr==0.001) && (ddz==0.001) &&
> (ubt==0.3))","same");
> ntuple1->SetMarkerStyle(4);
> ntuple1->SetMarkerColor(7);
> ntuple1->Draw("zovern:sigma","((ddr==0.001) && (ddz==0.001) &&
> (ubt==1.0))","same");
> ntuple1->SetMarkerStyle(26);
> ntuple1->SetMarkerColor(8);
> ntuple1->Draw("zovern:sigma","((ddr==0.001) && (ddz==0.001) &&
> (ubt==3.0))","same");
> ntuple1->SetMarkerStyle(29);
> ntuple1->SetMarkerColor(9);
> ntuple1->Draw("zovern:sigma","((ddr==0.001) && (ddz==0.001) &&
> (ubt==5.0))","same");
> leg->AddEntry(ntuple1,"ubt=5","P");
> leg->Draw();



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET