Re: [ROOT] a question

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri May 28 2004 - 17:30:12 MEST


o something like

{
   const int nfiles = 7;
   int color[] = {1,2,3,4,5,6,7}; //to be customized
   int marker[] = {21,22,23,24,25,26,27};

   TMultiGraph *multi = new TMultiGraph();
   for (int f=0;f<nfiles;f++) {
      TFile *afile = new TFile(filename..);
      TGraph *g = (TGraph*)afile->Get(graphname);
      delete afile;
      g->SetMarkerStyle(marker[f]);
      g->SetLineColor(color[f]); //or any other attribute
      multi->Add(g);
   }
   multi->Draw("alp");
}

Rene Brun

kenan@fnal.gov wrote:
> 
> Dear Majordomo,
> I'm a new user of root and I have a problem. I have more than 10 root
> graphs located in different root files. Instead of opening them
> individually, I want to open all of them in a window overlapped with
> different colors. There is an example for histograms in root manual on
> page 192. But I can not modify it for TGraphs. Do I need to write a
> script which reads all these root files and overlaps these graphs with
> different colors, or is there an esier way to do it in root? Would you
> help me for this problem? Thanks a lot.
> 
> Kenan



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET