Re: How to define the x and y axies label on TMultigraph

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Thu, 12 Feb 2009 14:08:24 +0100


do:
TMultiGraph *mg4 = new TMultiGraph();

mg4->Add(gr5);
mg4->Add(gr6);
mg4->SetMaximum(2);
mg4->SetMinimum(-2);
mg4->Draw("AP");
mg4->GetXaxis()->SetTitle(" E_{#gamma} (GeV))";
mg4->GetYaxis()->SetTitle("Coefficients" );

Rene brun

Paraduan Hutauruk wrote:
> Hi,
>
> I tried using the command that you gave but i got the error message
> when i ran my code. You can see a part of my code and the message
> error below :
>
> TCanvas *c1 = new TCanvas("c1","Extracted Coefficients",200,10,800,350);
>
> TGraphErrors *gr5 = new TGraphErrors(nSelected3,energy,a0_M3,0,era0_M3);
> gr5->SetMarkerColor(kBlue);
> gr5->SetMarkerStyle(21);
> TGraphErrors *gr6 = new
> TGraphErrors(nSelected8,energy,a0s_M3,0,era0s_M3);
> gr6->SetMarkerColor(kGreen);
> gr6->SetMarkerStyle(21);
>
> // draw multi graph
> TMultiGraph *mg4 = new TMultiGraph();
> mg4->Add(gr5);
> mg4->Add(gr6);
> mg4->GetXaxis()->SetTitle(" E_{#gamma} (GeV))";
> mg4->GetYaxis()->SetTitle("Coefficients" );
> mg4->SetMaximum(2);
> mg4->SetMinimum(-2);
> mg4->Draw("AP");
>
> root [0] .x pargraph.C
> Error: illegal pointer to class object GetXaxis() 0x0 470 pargraph.C:274:
> *** Interpreter error recovered ***
>
> Cheers,
> Parada Hutauruk
>
>
> Olivier Couet wrote:
>> Hi,
>>
>> To set the a multigraph axis titles do:
>>
>> Mg->GetXaxis()->SetTitle("x title"); Mg->GetYaxis()->SetTitle("y
>> title");
>>
>> Cheers,
>> O.Couet
>>
>> -----Original Message-----
>> From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch]
>> On Behalf Of parada hutauruk
>> Sent: Wednesday, February 11, 2009 6:35 PM
>> To: roottalk_at_root.cern.ch; Lorenzo Moneta
>> Subject: [ROOT] How to define the x and y axies label on TMultigraph
>>
>> Hi,
>>
>> Does anyone help me how to make x and y axis label on TMultigraph?
>> or can anyone guide me to find it? i tried to look at on manual and
>> reference guide on website, however i did not find it.
>>
>> Cheers,
>> Parada Hutauruk
>>
>>
>
Received on Thu Feb 12 2009 - 14:02:23 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 12 2009 - 17:50:01 CET