{ TH1D * hist = new TH1D("htemp", "ttt", 100, 0, 3); TGraph *gr = new TGraph(2); gr->SetPoint(0, 1,1); gr->SetPoint(1, 2,2); gr->SetHistogram(hist); // comment this line to make it work gr->Draw("a*"); gr->GetHistogram()->GetXaxis()->SetAxisColor(4); gr->GetHistogram()->GetYaxis()->SetAxisColor(2); TFile f("ttt.root", "RECREATE"); gr->Write(); }