Re: Error bars

From: Monika Sharma <monika_at_rcf.rhic.bnl.gov>
Date: Mon, 29 Jan 2007 09:29:46 +0530

Hi Rene,

I tried it this way :


  Float_t x1[] = {Some values..........}
  Float_t y1[] = {Some values..........};
  Float_t ex[] = {0,0,0,0,0,0,0};
  Float_t ey[] = {0,0,0,0,0,0,0};

  gr1 = new TGraphErrors(n,x1,y1,ex,ey);
  Double_t *nx = gr1->GetX();
  Double_t *ny = gr1->GetY();
  Double_t *ney = gr1->GetEY();
  Double_t *nex = gr1->GetEX();

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

      TMarker *m = new TMarker(nx[i],ny[i],nex[i],ney[i],22);
      m->SetMarkerColor(kBlue);
      m->SetMarkerSize(1.2);
      m->Draw();

    }

But looks like I can only pass (gr1->GetX(), gr1->GetY(), MarkerStyle) and not the errors. Is there any way that I draw errors on these markers? Also, I didn't fine any function in TMarker class which can return me errors in gr1.

Thanks
Monika

Rene Brun wrote:

> Monika Sharma wrote:
>
>>
>> Hi Rooters,
>>
>> I have been using the demo example given in Chapter 4 (Graphs), page 53,
>> in User's guide. This program draws markers with different colours
>> taking
>> input from graph, i.e.,
>>
>> Double_t *nx = gr3->GetX();
>> Double_t *ny = gr3->GetY();
>>
>> I wanted to ask is there any way with which it can take errors
>> too........
>> Something like :
>>
>> Double_t *nex = gr4->GetEX();
>> where gr4 is TGraphErrors and EX is the error on x
>> Is it possible?
>
> YES. In the example replace TGraph by TGraphErrors and define your
> errors in x and/or y
>
> Rene Brun
>
>>
>> Thanks
>> Monika
>
Received on Mon Jan 29 2007 - 05:00:18 CET

This archive was generated by hypermail 2.2.0 : Mon Jan 29 2007 - 11:50:01 CET