Re: TGraph2DErrors

From: Olivier Couet <couet_at_mail.cern.ch>
Date: Wed, 22 Jun 2005 09:47:31 +0200 (CEST)

Try this:

void graph2derrors()
{

   gStyle->SetPadBorderMode(0);
   gStyle->SetFrameBorderMode(0);
   gStyle->SetCanvasBorderMode(0);
                                                                                
   TCanvas *c = new TCanvas("c","Graph2DErrors example",0,0,600,600);
   Double_t P = 6.;
   Int_t np = 200;                                                                                 

   Double_t *rx=0, *ry=0, *rz=0;
   Double_t *ex=0, *ey=0, *ez=0;                                                                                 

   rx = new Double_t[np];
   ry = new Double_t[np];
   rz = new Double_t[np];
   ex = new Double_t[np];
   ey = new Double_t[np];
   ez = new Double_t[np];
                                                                                
   TRandom *r = new TRandom();
                                                                                
   for (Int_t N=0; N<np; N++) {
      rx[N] = 2*P*(r->Rndm(N))-P;
      ry[N] = 2*P*(r->Rndm(N))-P;
      rz[N] = rx[N]*rx[N]-ry[N]*ry[N];
      ex[N] = r->Rndm(N);
      ey[N] = r->Rndm(N);
      ez[N] = r->Rndm(N);

   }
   gStyle->SetPalette(1);                                                                                 

   TGraph2DErrors *dte = new TGraph2DErrors(np, rx, ry, rz, ex, ey, ez);                                                                                 

   dte->SetFillColor(29);
   dte->SetMarkerSize(0.5);
   dte->Draw("E");

}

O.Couet

On Wed, 22 Jun 2005, Danilo Piparo wrote:

> Hi everybody,
> I want to create a TGraph2DErrors and show in my graph the points and the
> errorbars. I tried the method Draw("eP") but it do not work. Could anybody
> help?
>
> Danilo Piparo
>
>
>

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7670300
Received on Wed Jun 22 2005 - 09:47:36 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:09 MET