Plotting the differences between two graphs

Note that the solution proposed by Olivier assumes that both graphs have exactly the same numbers of points and that their X coordinates are exactly the same (for all points).

If any of the above conditions is not met, try:

{
  // Note: this macro needs ROOT 6
  
  // define some variables used below
  Double_t x[100], y[100];
  Int_t n;
  
  // create the first graph
  n = 22;
  for (Int_t i = 0; i < n; i++) {
    x[i] = i * TMath::Pi() / (n - 1.);
    y[i] = TMath::Sin(x[i]);
  }
  TGraph *geant_lead = new TGraph(n, x, y);
  geant_lead->SetTitle("geant_lead;X;Y");
  
  // create the second graph
  n = 33;
  for (Int_t i = 0; i < n; i++) {
    x[i] = i * TMath::Pi() / (n - 1.);
    y[i] = TMath::Cos(x[i]);
  }
  TGraph *fluka_lead = new TGraph(n, x, y);
  fluka_lead->SetTitle("fluka_lead;X;Y");
  
  // create the difference graph
  std::vector<Double_t> v;
  v.insert( v.end(), geant_lead->GetX(), (geant_lead->GetX() + geant_lead->GetN()) );
  v.insert( v.end(), fluka_lead->GetX(), (fluka_lead->GetX() + fluka_lead->GetN()) );
  std::sort( v.begin(), v.end() );
  v.erase( std::unique( v.begin(), v.end() ), v.end() );
  n = v.size();
  TGraph *diff_lead = new TGraph(n);
  for (Int_t i = 0; i < n; i++)
    diff_lead->SetPoint( i, v[i], (geant_lead->Eval(v[i]) - fluka_lead->Eval(v[i])) );
  diff_lead->SetTitle("geant_lead - fluka_lead;X;#Delta Y");
  
  // draw everything
  TCanvas *c = new TCanvas("c", "c");
  c->Divide(1, 3);
  c->cd(1);
  geant_lead->Draw("AL*");
  c->cd(2);
  fluka_lead->Draw("AL*");
  c->cd(3);
  diff_lead->Draw("AL*");
  c->cd(0);
}