Re: BuildLegend and gPad

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 8 Dec 2011 07:34:59 -0600


Hi,

The problem is not really about CINT.
It strictly due to the fact that TVirtualPad (the type pointed to by gPad) does *not* have a BuildLegend member function.

Cheers,
Philippe.

On 12/8/11 4:45 AM, Axel Naumann wrote:
> 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();
>>
Received on Thu Dec 08 2011 - 14:35:07 CET

This archive was generated by hypermail 2.2.0 : Thu Dec 08 2011 - 17:50:01 CET