Hi Giuseppe,
before invoking GetXaxis() you should Draw() the Graph:
On Mon, 8 Jan 2001 Giuseppe.LoRe@ct.infn.it wrote:
>
> Hi, i have a little problem with TGraph.
> How can i put a title to an axis?
> I try with ...->GetXaxis()->SetTitle("..") but i obtain
> Error: illegal pointer to class object GetXaxis() 0x0 122.
>
TGraph *mltplct_gr1 = new TGraph(12, Zv, z1);
mltplct_gr1->SetLineColor(2);
mltplct_gr1->SetLineWidth(2);
mltplct_gr1->SetMarkerColor(4);
mltplct_gr1->SetMarkerStyle(21);
mltplct_gr1->Draw("ACP"); //<<<<<<<<<<<<<<<
mltplct_gr1->GetXaxis()->SetTitle("Zv");
gPad->Modified(kTRUE);
mltplct_gr1->SetTitle("Moltiplicity versus
primary vertex position\n");
>
Best regards,
Otto
>
Dr. Otto Schaile Sektion Physik, LMU Muenchen
Phone: +49 89 289 14070 Am Coulombwall 1, D-85748 Garching, Germany
GSM: +49 171 4312031
FAX: +49 89 289 14072 EMail: Otto.Schaile@Physik.Uni-Muenchen.DE
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:33 MET