I am writing a Root macro that plots multiple TGraph-s on a single TCanvas. A simple test:
TCanvas *canvas=new TCanvas("Plot 1","Plot 1");
float x[] = {0.5,0.5,1.5,1.5,2.5,2.5,3.5,3.5,4.5,4.5,5.5,5.5,6.5,6.5,7.5,7.5,8.5,8.5,9.5,9.5,};
float y[] = {0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,0,};
canvas->DrawFrame(0.5,0,9.5,9,"Chart Title;X Label;Y Label");
TGraph *graph = new TGraph(20,x,y);
graph->Draw("L");
graph->GetXaxis()->CenterTitle();
graph->GetYaxis()->CenterTitle();
canvas->Update();
However the xLabel and yLabel are drawn at the top and right, not centered on their axes. This looks ugly (why is that the default???).
How can I center the xLabel and yLabel of the axes?
I have been unable to find any analog to graph->GetXaxis() for TCanvas or TPad, and centering that does nothing.
Tom Roberts