Re: problem with option E2 in TGraphAsymmErrors

From: Olivier Couet <couet_at_mail.cern.ch>
Date: Mon, 7 Feb 2005 10:11:24 +0100 (CET)

Hi,

 Why do you need h1 ?. The following macro is enough seems to me:



void test() {

   TCanvas *c1= new TCanvas();
   c1->Divide(2,2);

   TGraphAsymmErrors* g1= new TGraphAsymmErrors();

   for (Int_t i=0; i<10; i++) {

     g1->SetPoint(i,i+0.5,1.);
     g1->SetPointError(i,0.25,0.25,i*1.1,i*1.1); 
   }
   c1->cd(1);
   g1->SetFillColor(2);
   g1->Draw("Ae2");

   c1->cd(2);
   g1->Draw("ae2");

   c1->cd(3);
   g1->Draw("ae3");

   c1->cd(4);
   g1->Draw("ae4");
}


It gives the attached output, which is correct.

 Olivier

On Sun, 6 Feb 2005, Tancredi Carli wrote:

>
> Hello Olivier,
>
> In my case, the first plot looks fine (I get the error band),
> in the second I do not get the error band, but just the points,
> but the third and the forth plots are ok, i.e. I have errors band,
> according to the option.
> I have no explanation, do you the correct results ?
>
> I am using version
> /afs/cern.ch/sw/root/v4.02.00/rh73_gcc32/root
>
> Thank you.
>
> Tancredi
>
>
>
>
>
>
>
>
>
> On Fri, 4 Feb 2005, Olivier Couet wrote:
>
> >
> > Hello,
> >
> > It is not clear for me what you would like to obtain. Seems to me the
> > plot you get is the one your macro should produce. Can you clarify a bit
> > the result you would like to get ?
> >
> > Cheers, Olivier
> >
> >
> > On Fri, 4 Feb 2005, Tancredi Carli wrote:
> >
> > >
> > > Hello,
> > >
> > > I have a problem to work with option E2 in TGraphAsymmErrors.
> > > It works fine, if I plot directly the Graph, but not when I
> > > plot it in a predefined frame.
> > >
> > > Can somebody help ?
> > >
> > > here is my test.C
> > >
> > > void test()
> > > {
> > >
> > > TCanvas *c1= new TCanvas();
> > > TH1F *h1 = c1->DrawFrame(0.,-10.,10.,12.);
> > > c1->Divide(2,2);
> > >
> > > TGraphAsymmErrors* g1= new TGraphAsymmErrors();
> > >
> > > for (Int_t i=0; i<10; i++) {
> > >
> > > g1->SetPoint(i,i+0.5,1.);
> > > g1->SetPointError(i,0.25,0.25,i*1.1,i*1.1);
> > >
> > > }
> > >
> > > c1->cd(1);
> > > g1->SetFillColor(2);
> > > g1->Draw("Ae2");
> > >
> > >
> > > c1->cd(2);
> > > h1->Draw();
> > > g1->Draw("e2");
> > >
> > > c1->cd(3);
> > > h1->Draw();
> > > g1->Draw("e3");
> > >
> > > c1->cd(4);
> > > h1->Draw();
> > > g1->Draw("e4");
> > >
> > > }
> > >
> > >
> >
> >
>
>

-- 
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

c1_n3.gif
Received on Mon Feb 07 2005 - 10:18:15 MET

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