Hi There
I Have drawn a TGraph but the axis dont start from 0. Is there a way of fixing the axis when you first declare the TGraph? I know what I want the min and max of both x and y axis to be.
Hi There
I Have drawn a TGraph but the axis dont start from 0. Is there a way of fixing the axis when you first declare the TGraph? I know what I want the min and max of both x and y axis to be.
{
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);
}
TGraph *gr1 = new TGraph (n,x,y);
TAxis *axis = gr1->GetXaxis();
axis->SetLimits(0.,5.); // along X
gr1->GetHistogram()->SetMaximum(20.); // along
gr1->GetHistogram()->SetMinimum(-20.); // Y
gr1->Draw("AC*");
}
Great, this works
Thanks