Hi Olivier,
How's that CINT-related? I don't see any TVirtualPad::BuildLegend(). Should it be added?
Cheers, Axel.
Olivier Couet wrote on 12/07/2011 09:55 AM:
>
> I see the same behavior on my Mac.
> Seems to me it is CINT related as the message tells that BuildLegend cannot be called.
>
> I would also recommend you create your histograms with "new" as you are using "->"
> to access the Draw(0 method:
>
> void buildlegend()
> {
> TH1F *h1 = new TH1F("h1","h1",100,-2,2);
> TH1F *h2 = new TH1F("h2","h2",100,-2,2);
>
> h1->FillRandom("gaus",10000);
> h2->FillRandom("gaus",10000);
>
> h1->SetLineColor(kRed);
> h2->SetLineColor(kBlue);
>
> TCanvas* cc = new TCanvas ("cc","cc",400,400);
> h1->Draw();
> h2->Draw("same");
>
> TLegend* leg = cc->BuildLegend();
> leg->SetFillColor(kWhite);
> cc->SetGrid();
> }
>
>
> On Dec 7, 2011, at 9:43 AM, Andrea Massironi wrote:
>
>> TH1F h1("h1","h1",100,-2,2); >> TH1F h2("h2","h2",100,-2,2); >> >> h1->FillRandom("gaus",10000); >> h2->FillRandom("gaus",10000); >> >> h1->SetLineColor(kRed); >> h2->SetLineColor(kBlue); >> >> TCanvas* cc = new TCanvas ("cc","cc",400,400); >> h1->Draw(); >> h2->Draw("same"); >> >> TLegend* leg = cc->BuildLegend(); >> leg->SetFillColor(kWhite); >> cc->SetGrid();
This archive was generated by hypermail 2.2.0 : Thu Dec 08 2011 - 17:50:01 CET