I often make empty TGraph objects set the axis titles and then fill them with points. As in this example:
TGraph *gr = new TGraph(); gr->GetXaxis()->SetTitle("X axis"); gr->GetYaxis()->SetTitle("Y axis"); for (int i=0; i < 10; ++i) gr->SetPoint(gr->GetN(),i,i);
Recently, I have tried this with TGraph2D, but the behavior is different and I receive the error
Is there any reason the behavior should be different?