ROOT » HIST » HIST » TGraph2DErrors

class TGraph2DErrors: public TGraph2D

Graph 2D class with errors

A TGraph2DErrors is a TGraph2D with errors. It behaves like a TGraph2D and has the same drawing options.

The "ERR" drawing option allows to display the error bars. The following example shows how to use it:

output of htmldoc/MACRO_TGraph2DErrors_1.gif
   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];
      rx[N] = 10.+rx[N];
      ry[N] = 10.+ry[N];
      rz[N] = 40.+rz[N];
      ex[N] = r->Rndm(N);
      ey[N] = r->Rndm(N);
      ez[N] = 10*r->Rndm(N);

   TGraph2DErrors *dte = new TGraph2DErrors(np, rx, ry, rz, ex, ey, ez);
   dte->SetTitle("TGraph2D with error bars: option \"ERR\"");
   dte->Draw("err p0");
   return c;

Function Members (Methods)

voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTGraph2D::Browse(TBrowser*)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTGraph2D::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual voidTGraph2D::DirectoryAutoAdd(TDirectory*)
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tTGraph2D::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTGraph2D::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTGraph2D::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TGraph2D::FindObject(const char* name) const
virtual TObject*TGraph2D::FindObject(const TObject* obj) const
virtual TFitResultPtrTGraph2D::Fit(const char* formula, Option_t* option = "", Option_t* goption = "")MENU
virtual TFitResultPtrTGraph2D::Fit(TF2* f2, Option_t* option = "", Option_t* goption = "")MENU
virtual voidTGraph2D::FitPanel()MENU
TList*TGraph2D::GetContourList(Double_t contour)
TDirectory*TGraph2D::GetDirectory() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Double_tGetErrorX(Int_t bin) const
virtual Double_tGetErrorY(Int_t bin) const
virtual Double_tGetErrorZ(Int_t bin) const
virtual Double_t*GetEX() const
virtual Double_t*GetEY() const
virtual Double_t*GetEZ() const
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
TH2D*TGraph2D::GetHistogram(Option_t* option = "")
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
TList*TGraph2D::GetListOfFunctions() const
Double_tTGraph2D::GetMargin() const
virtual Color_tTAttMarker::GetMarkerColor() const
virtual Size_tTAttMarker::GetMarkerSize() const
virtual Style_tTAttMarker::GetMarkerStyle() const
Double_tTGraph2D::GetMaximum() const
Double_tTGraph2D::GetMinimum() const
Int_tTGraph2D::GetN() const
virtual const char*TNamed::GetName() const
Int_tTGraph2D::GetNpx() const
Int_tTGraph2D::GetNpy() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
Double_t*TGraph2D::GetX() const
TAxis*TGraph2D::GetXaxis() const
Double_tTGraph2D::GetXmax() const
virtual Double_tGetXmaxE() const
Double_tTGraph2D::GetXmin() const
virtual Double_tGetXminE() const
Double_t*TGraph2D::GetY() const
TAxis*TGraph2D::GetYaxis() const
Double_tTGraph2D::GetYmax() const
virtual Double_tGetYmaxE() const
Double_tTGraph2D::GetYmin() const
virtual Double_tGetYminE() const
Double_t*TGraph2D::GetZ() const
TAxis*TGraph2D::GetZaxis() const
Double_tTGraph2D::GetZmax() const
virtual Double_tGetZmaxE() const
Double_tTGraph2D::GetZmin() const
virtual Double_tGetZminE() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
Double_tTGraph2D::Interpolate(Double_t x, Double_t y)
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttLine::Modify()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TGraph2DErrors&operator=(const TGraph2DErrors&)
virtual voidTGraph2D::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
TH1*TGraph2D::Project(Option_t* option = "x") constMENU
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
Int_tTGraph2D::RemovePoint(Int_t ipoint)MENU
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
virtual voidTAttMarker::ResetAttMarker(Option_t* toption = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidTAttMarker::SaveMarkerAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t sizdef = 1)
virtual voidTGraph2D::SavePrimitive(ostream& out, Option_t* option = "")
virtual voidSet(Int_t n)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTGraph2D::SetDirectory(TDirectory* dir)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillColorAlpha(Color_t fcolor, Float_t falpha)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
virtual voidTGraph2D::SetHistogram(TH2* h)
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidTAttLine::SetLineColor(Color_t lcolor)
virtual voidTAttLine::SetLineColorAlpha(Color_t lcolor, Float_t lalpha)
virtual voidTAttLine::SetLineStyle(Style_t lstyle)
virtual voidTAttLine::SetLineWidth(Width_t lwidth)
voidTGraph2D::SetMargin(Double_t m = 0.10000000000000001)MENU
voidTGraph2D::SetMarginBinsContent(Double_t z = 0.)MENU
virtual voidTAttMarker::SetMarkerAttributes()MENU
virtual voidTAttMarker::SetMarkerColor(Color_t mcolor = 1)
virtual voidTAttMarker::SetMarkerColorAlpha(Color_t mcolor, Float_t malpha)
virtual voidTAttMarker::SetMarkerSize(Size_t msize = 1)
virtual voidTAttMarker::SetMarkerStyle(Style_t mstyle = 1)
voidTGraph2D::SetMaximum(Double_t maximum = -1111)MENU
voidTGraph2D::SetMaxIter(Int_t n = 100000)MENU
voidTGraph2D::SetMinimum(Double_t minimum = -1111)MENU
virtual voidTGraph2D::SetName(const char* name)MENU
virtual voidTGraph2D::SetNameTitle(const char* name, const char* title)
voidTGraph2D::SetNpx(Int_t npx = 40)MENU
voidTGraph2D::SetNpy(Int_t npx = 40)MENU
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetPoint(Int_t i, Double_t x, Double_t y, Double_t z)
virtual voidSetPointError(Int_t i, Double_t ex, Double_t ey, Double_t ez)
virtual voidTGraph2D::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TGraph2DErrors(Int_t n)
TGraph2DErrors(const TGraph2DErrors&)
TGraph2DErrors(Int_t n, Double_t* x, Double_t* y, Double_t* z, Double_t* ex = 0, Double_t* ey = 0, Double_t* ez = 0, Option_t* option = "")
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
voidTGraph2D::Build(Int_t n)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const

Data Members

static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
TDirectory*TGraph2D::fDirectory!Pointer to directory holding this 2D graph
Double_t*fEX[fNpoints] array of X errors
Double_t*fEY[fNpoints] array of Y errors
Double_t*fEZ[fNpoints] array of Z errors
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
TList*TGraph2D::fFunctionsPointer to list of functions (fits and user)
TH2D*TGraph2D::fHistogram!2D histogram of z values linearly interpolated on the triangles
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
Double_tTGraph2D::fMarginExtra space (in %) around interpolated area for fHistogram
Color_tTAttMarker::fMarkerColorMarker color index
Size_tTAttMarker::fMarkerSizeMarker size
Style_tTAttMarker::fMarkerStyleMarker style
Int_tTGraph2D::fMaxIterMaximum number of iterations to find Delaunay triangles
Double_tTGraph2D::fMaximumMaximum value for plotting along z
Double_tTGraph2D::fMinimumMinimum value for plotting along z
TStringTNamed::fNameobject identifier
Int_tTGraph2D::fNpointsNumber of points in the data set
Int_tTGraph2D::fNpxNumber of bins along X in fHistogram
Int_tTGraph2D::fNpyNumber of bins along Y in fHistogram
TVirtualHistPainter*TGraph2D::fPainter!Pointer to histogram painter
Int_tTGraph2D::fSize!Real size of fX, fY and fZ
TStringTNamed::fTitleobject title
Double_t*TGraph2D::fY[fNpoints] Data set to be plotted
Double_tTGraph2D::fZoutfHistogram bin height for points lying outside the interpolated area

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

 TGraph2DErrors default constructor
TGraph2DErrors(Int_t n)
 TGraph2DErrors normal constructor
 the arrays are preset to zero
TGraph2DErrors(Int_t n, Double_t* x, Double_t* y, Double_t* z, Double_t* ex = 0, Double_t* ey = 0, Double_t* ez = 0, Option_t* option = "")
 TGraph2DErrors constructor with doubles vectors as input.
 TGraph2DErrors destructor.
TGraph2DErrors(const TGraph2DErrors& )
 Copy constructor.
 Copy everything except list of functions
TGraph2DErrors & operator=(const TGraph2DErrors& )
 Assignment operator
 Copy everything except list of functions
Double_t GetErrorX(Int_t bin) const
 This function is called by Graph2DFitChisquare.
 It returns the error along X at point i.
Double_t GetErrorY(Int_t bin) const
 This function is called by Graph2DFitChisquare.
 It returns the error along X at point i.
Double_t GetErrorZ(Int_t bin) const
 This function is called by Graph2DFitChisquare.
 It returns the error along X at point i.
Double_t GetXmaxE() const
 Returns the X maximum with errors.
Double_t GetXminE() const
 Returns the X minimum with errors.
Double_t GetYmaxE() const
 Returns the Y maximum with errors.
Double_t GetYminE() const
 Returns the Y minimum with errors.
Double_t GetZmaxE() const
 Returns the Z maximum with errors.
Double_t GetZminE() const
 Returns the Z minimum with errors.
void Set(Int_t n)
 Set number of points in the 2D graph.
 Existing coordinates are preserved.
 New coordinates above fNpoints are preset to 0.
void SetPoint(Int_t i, Double_t x, Double_t y, Double_t z)
 Set x, y and z values for point number i
void SetPointError(Int_t i, Double_t ex, Double_t ey, Double_t ez)
 Set ex, ey and ez values for point number i
void Streamer(TBuffer& )
 Stream an object of class TGraphErrors.
Double_t * GetEX() const
{return fEX;}
Double_t * GetEY() const
{return fEY;}
Double_t * GetEZ() const
{return fEZ;}