For scatter plot I can use the TGraph, but how to have text labels along both axes ?
void graph() {
const Int_t n = 20;
Double_t x[n], y[n];
for (Int_t i=0;i<n;i++) {
x[i] = i*0.1;
y[i] = 10*sin(x[i]+0.2)-5;
}
TGraph *gr = new TGraph(n,x,y);
gr->Draw("A*L");
gr->GetXaxis()->SetTitle("X-Axis");
gr->GetYaxis()->SetTitle("Y-Axis");
}
Sorry about my quoting as “text labels”. In place of numbers I would like to have text labels as in
‘A’, ‘B’, ‘C’, ‘D’ and so on along both the X and Y Axis. I don’t know what the right name to use for “text labels”. The example hlabels1 under tutorials/hist was useful to do it.
I am lost when it comes to doing for TGraphs as I am doing a scatter plot.
That’s for histograms only. Label are on bins. A TGraph has no bins.