Hi Giuseppe, you have to first draw the graph with option "A" as you do. Only then you can access the axis. Float_t Zv[4]={1.,2.,3.,4.}; Float_t z1[4]={1.,2.,3.,4.}; TGraph *mltplct_gr1 = new TGraph(4, Zv, z1); mltplct_gr1->SetTitle("Multiplicity versus primary vertex position\n"); mltplct_gr1->Draw("ACP"); mltplct_gr1->GetXaxis()->SetTitle("Zv"); gPad->Modified(); Miro > > 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->GetXaxis()->SetTitle("Zv"); > mltplct_gr1->SetTitle("Moltiplicity versus primary vertex position\n"); > mltplct_gr1->Draw("ACP"); > > Best regards, Giuseppe Lo Re. > >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:33 MET