How to increase axis length

I am trying to use TGraph and TMultiGraph classes.
The issue is I want to increase the length of x and Y axis. How do I do that?

Hi @nikhil_bhathi,
the SetRange and SetRangeUser methods change the axes ranges (e.g. graph.GetXaxis()->SetRangeUser(min, max)). See the documentation of TAxis, which is what GetXaxis and GetYaxis return.

If you can provide a small snippet of code that should do what you want but does not we can probably help further.

Cheers,
Enrico

Hi @eguiraud ,
Thank you for your reply.
I tried the code but it didn’t work.
I am also unable to use TLegend class(it is commented). Could you take a look at this too?
Thank you
ArCu6.c (526 Bytes)

Missing files:

Processing ArCu6.c...
Error in <TGraph::TGraph>: Cannot open file: Ar6.txt, TGraph is Zombie
Error in <TGraph::TGraph>: Cannot open file: Cu6.txt, TGraph is Zombie

Hi @couet
I am sorry I forgot to insert them.
Here they are.Ar6.txt (16.4 KB) Cu6.txt (17.3 KB)

void ArCu6()
{

   TGraph *Ar = new TGraph("Ar6.txt");
   Ar->SetLineColor(kBlue);

   TGraph *Cu = new TGraph("Cu6.txt");
   Cu->SetLineColor(kRed);

   TMultiGraph *Mg = new TMultiGraph();
   Mg->Add(Ar);
   Mg->Add(Cu);

   Mg->GetXaxis()->SetTitle("#theta_{Lab} (deg)");
   Mg->GetYaxis()->SetTitle("Energy (MeV/u)");
   Mg->GetXaxis()->CenterTitle();
   Mg->GetYaxis()->CenterTitle();

   Mg->GetXaxis()->SetLimits(0.,2.);
   Mg->Draw("AC");

   TLegend *lg = new TLegend (.7,.8,.9,.9);
   lg->AddEntry(Ar,"40^{Ar}","l");
   lg->AddEntry(Cu,"59^{Cu}","l");
   lg->Draw();
}

I modified the macro in order to show the legend (it was not drawn).
And the axis limits should be changed (not the range).