Large number of plots

From: lijowski@cosray2.wustl.edu
Date: Wed Aug 05 1998 - 20:26:49 MEST


   Hello Rooters,

   In my applications I would like to put large number of plots/
   histograms into a single Postscript file. Below is a test macro
   which crashes root on my X-terminal whenever number of plots/canvas
   exceeds approximately 18. This is related to the fact that root 
   opens too many windows.

   Is it a way to send plots only to Postscript file without
   displaying them or use only a single canvas to display 
   multiple plots and append consecutive plots into a single
   Postscript file. 

   One solution to this problem would be to scatter plots among multiple
   Postscript files.

   Any comments or suggestions?

   Regards,

  Michal Lijowski

------------------------------------------------------------------------
Michal Lijowski                  Washington University
Research Associate               St. Louis, MO 63130-4899, USA 
Department of Physics            phone:   314-935-6285
Campus Box 1105                  email:   lijowski@cosray2.wustl.edu
------------------------------------------------------------------------ 

  {
  //Reset ROOT
   gROOT->Reset();

   gBenchmark->Start("test_ps_2");

 //    Int_t type = 111;
    Int_t type = 112;
//  Int_t type = 113;

   Int_t  nentries = 6280;
   Float_t  xx[nentries], yy1[nentries], yy2[nentries];

   xx[0] = -3.1415;
   yy1[0] = sin(xx[0]);
   yy2[0] = cos(xx[0]);
   for  (Int_t  ii = 1; ii < nentries; ii++) {
      xx[ii] = xx[ii - 1] + 0.001;
      yy1[ii] = sin(xx[ii]);
      yy2[ii] = cos(xx[ii]);
   }

   TPostScript ps("test_ps_2.ps", type);
   ps.Range(24, 16);

   Int_t  nplots = 20;
   TCanvas *c[nplots];
   char  ctitle[10], gtitle[80];

   for  (ii = 0; ii < nplots; ii++) {
       ps -> NewPage();
       sprintf(ctitle, "c%d", ii);
//       c[ii] = new TCanvas(ctitle);
       c1 = new TCanvas(ctitle);

       if (fmod(ii, 2) == 0) {
           gr = new TGraph(nentries, xx, yy1);
           gr ->SetFillColor(0);
           gr ->SetLineColor(7);
           gr ->SetLineWidth(2);
           sprintf(gtitle, "Sine function  Page %d", ii);
           gr ->SetTitle(gtitle);
       }
       else {
           gr = new TGraph(nentries, xx, yy2);
           gr ->SetFillColor(0);
           gr ->SetLineColor(12);
           gr ->SetLineWidth(3);
           sprintf(gtitle, "Cosine function  Page %d", ii);
           gr ->SetTitle(gtitle);
       }

       gr->Draw("AL");
       c1 -> Update();
//       c[ii] -> Update();
   }
 
   ps.Close();
   gBenchmark->Show("test_ps_2");
}
  



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:35 MET