Re: [ROOT] TMultiGraph error in connection with GetAxis

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun Mar 02 2003 - 08:30:22 MET


Hi Michael,

Move the line 
   mg->GetXaxis()->SetTitle("ms");
after mg->Draw

The axis object is only created when painting the graph.
I already changed TGraph to avoid this problem and forgot
to make the same change to TMultiGraph.

Rene Brun

On Sat, 1 Mar 2003, Michael T. Gericke 
wrote:

> 
> Hi ROOTers,
> 
> I am using the TMultiGraph Class in the following way:
> 
>   TMultiGraph *mg = new TMultiGraph();
>   mg->SetTitle("Lock-In Amplifier Technique Signals");
>   mg->GetXaxis()->SetTitle("ms");
>   mg->Add(gr1);
>   mg->Add(gr2);
>   mg->Add(gr3);
>   mg->Draw("ALP");
> 
> 
> When I run my file on the root command line, I get the
> following error:
> 
> Error: illegal pointer to class object GetXaxis() 0x0 138  
> FILE:Rot_Src_Scope_Out.C LINE:107
> 
> I know that this refers to the line "mg->GetXaxis()->SetTitle("bla")",
> because if I remove it the error doesn't come up.
> 
> Does anyone know how to set the axis titles for a TMultiGraph?
> 
> Thanks,
> 
> Michael Gericke
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET