RE: [ROOT] TMultiGraph ...

From: Philippe Canal (pcanal@fnal.gov)
Date: Sun Aug 17 2003 - 06:17:15 MEST


Hi,

Currently to access the axis for a TMultiGraph, you first need to draw it
and make sure the drawing actually happened.  i.e do
	mg->Draw("ap");
	gPad->Update();

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of zaldy
Sent: Saturday, August 16, 2003 4:31 AM
To: Stanislav Nesterov
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] TMultiGraph ...



Hi,


Thanks for reminding. It was a clerical error while am typing it in
roottalk.

I re-submit again. I rechecked again my original code
Am using the notation "->" not the "." notation.
I used ROOT 3.05/05 gcc 3.3.3 Redhat 9.0

///////////////////////////////////////////////////////////
> >Why is the ff. always givves a "illegal pointer" message?
> >
> >   TMultiGraph * mg =  new TMultiGraph();
> >   TGraph * G[100];
> >   .....
> >   for (int i ....) {
> >     mg->Add(G[i]);
> >   }
> >
> >   mg->Draw("ap");
> >   mg->GetXaxis()->SetTitle("TIiiii");
> >   gPad->Modified();
> >
> >
> >
> >I wanted to put an X label as well as Y Label.
> >
> >I tried, TAxis * axis = (TAxis *)mg->GetXaxis();
> >         axis->SetTitle("XTITLE");
> >
> >But illegal pointer message again.
> >
> >How ever, I can make this with TGraph.
> >Why? Isnt it true that TMultigraph is just related to TGraph?
> >Could this be a bug?
////////////////////////////////////////////////////////////////////



>
> You must be careful with '.' and '->' operators. After *mg = new ....
> you can use only '->' notation to resolve object methods and variables,
> 'cause 'mg' is the pointer, not the very object. So change mg. to mg->
> everywhere.
>
>                          Best regards,
>
> Stanislav.
>
> zaldy wrote:
>
> >Hello,
> >
> >
> >Why is the ff. always givves a "illegal pointer" message?
> >
> >   TMultiGraph * mg =  new TMultiGraph();
> >   TGraph * G[100];
> >   .....
> >   for (int i ....) {
> >     mg.Add(G[i]);
> >   }
> >
> >   mg.Draw("ap");
> >   mg->GetXaxis()->SetTitle("TIiiii");
> >   gPad->Modified();
> >
> >
> >
> >I wanted to put an X label as well as Y Label.
> >
> >I tried, TAxis * axis = (TAxis *)mg->GetXaxis();
> >         axis->SetTitle("XTITLE");
> >
> >But illegal pointer message again.
> >
> >How ever, I can make this with TGraph.
> >Why? Isnt it true that TMultigraph is just related to TGraph?
> >Could this be a bug?
> >
> >
> >Thanks
> >
> >I used ROOT 3.05/05 gcc 3.3.3 Redhat 9.0
> >
> >
> >
>
>

--

--------------------------------------------------------
                   Zaldy A. Nawang
                   PS Users Room 2
                   Yon Gokan,
                   E362, Neutrino Group,
                   IPNS, KEK,
                   Japan

                   e-mail: zaldy@neutrino.kek.jp
                   Tel. No. : (81) 029864 - 5387
--------------------------------------------------------



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