3 Graphs in 3 pads from one TTree?

Hello,

I have a single TTree filled with data and I was hoping to display X vs Steps, Y vs Steps, Z vs Steps in three different Canvas pads. I read through the documentation, but I’m still not quite clear on how to accomplish this. The code I have so far is

  TCanvas *cv = new TCanvas();

                                                                       
  //access steps, x, y, and z with mytree->GetV1()...GetV4() respectively                                                                                    
  //after the tree is drawn once.                                                                                                                            
  mytree->Draw("steps:x:y:z");

  cv->Divide(3,1); // 3 along x 1 along Y                                                                                                                    

  //Create a new Graph for Canvas pad 1,1 that will hold X vs Steps                                                                                          
  cv->cd(1);
  TGraph *gr1 = new TGraph(mytree->GetEntries(), mytree->GetV2(), mytree->GetV1());
  gr1->Draw("AC*");


  //Create a new Graph for next canvas that will hold Y vs Steps                                                                                             
  cv->cd(2);
  TGraph *gr2 = new TGraph(mytree->GetEntries(), mytree->GetV3(), mytree->GetV1());
  gr2->Draw("C*");


  //Create a new Graph for next canvas that will hold Z vs Steps                                                                                             
  cv->cd(3);
  TGraph *gr3 = new TGraph(mytree->GetEntries(), mytree->GetV4(), mytree->GetV1());
  gr3->Draw("C*");

This, however, seems to create only one graph in 1 of the 3 allocated spots.

Any suggestions?

Thanks in advance,
mw

Sho changes below in lines with //<===

Rene

[code] TCanvas *cv = new TCanvas();

//access steps, x, y, and z with mytree->GetV1()…GetV4() respectively
//after the tree is drawn once.
mytree->Draw(“steps:x:y:z”,"",“goff”); //<====

cv->Divide(3,1); // 3 along x 1 along Y

//Create a new Graph for Canvas pad 1,1 that will hold X vs Steps
cv->cd(1);
TGraph gr1 = new TGraph(mytree->GetEntries(), mytree->GetV2(), mytree->GetV1());
gr1->Draw("AC
");

//Create a new Graph for next canvas that will hold Y vs Steps
cv->cd(2);
TGraph gr2 = new TGraph(mytree->GetEntries(), mytree->GetV3(), mytree->GetV1());
gr2->Draw("AC
"); //<======

//Create a new Graph for next canvas that will hold Z vs Steps
cv->cd(3);
TGraph gr3 = new TGraph(mytree->GetEntries(), mytree->GetV4(), mytree->GetV1());
gr3->Draw("AC
"); //<=====
[/code]

Ahhh! That is great, thanks!

I purposefully left off the A as an option on the other graphs because I thought it was necessary from the Superimposing Two Graphs section of the ROOT manual. I realize that is sorta silly now because I wasn’t actually superimposing graphs.

Thanks again!