Re: segfault in TLegendEntry->SetTextSize

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Mon, 19 Sep 2011 08:00:16 +0000


Try this:

{

   TH1F *h1 = new TH1F("h1","h1",100,-10,10);    h1->FillRandom("gaus",1000);
   h1->SetMarkerStyle(20);

   TLegend *leg = new TLegend(0.1,0.5,0.3,0.7);

   leg->AddEntry(h1,"A gaussian","LEP");
   leg->SetTextFont(62);
   leg->SetTextSize(0.025);

   h1->Draw("histe1");
   leg->Draw();
}
---
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910
E-Mail: Olivier.Couet_at_cern.ch<mailto:Olivier.Couet_at_cern.ch>                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7670300


On Sep 18, 2011, at 7:19 PM, Adrian Sevcenco wrote:

TLegend *leg = new
TLegend(0.454023,0.5127119,0.8333333,0.7224576,NULL,"brNDC");
 leg->SetTextFont(20);
 leg->SetLineColor(1);
 leg->SetLineStyle(1);
 leg->SetLineWidth(1);
 leg->SetFillColor(19);
 leg->SetFillStyle(1001);

 TLegendEntry* entry = NULL;

 entry = leg->AddEntry("fH1","text 1","lpf");
 entry->SetFillStyle(1001);
 entry->SetLineColor(1);
 entry->SetLineStyle(1);
 entry->SetLineWidth(1);
 entry->SetMarkerColor(2);
 entry->SetMarkerStyle(20);
 entry->SetMarkerSize(1);
 entry->SetTextSize(20);


 entry = leg->AddEntry("fH1mc","text 2","lpf");
 entry->SetFillStyle(1001);
 entry->SetLineColor(1);
 entry->SetLineStyle(1);
 entry->SetLineWidth(1);
 entry->SetMarkerColor(51);
 entry->SetMarkerStyle(20);
 entry->SetMarkerSize(1);
 leg->Draw();
Received on Mon Sep 19 2011 - 10:00:21 CEST

This archive was generated by hypermail 2.2.0 : Mon Sep 19 2011 - 11:50:01 CEST