Unknown type name 'TGraphMultiErrors'

Hello everyone,
I am using TGraphMultiErrors to plot stat. and sys,but I found it doesn’t work.
I run a example exactly followed manual.

   auto c1 = new TCanvas("c1", "A Simple Graph with multiple y-errors", 200, 10, 700, 500);
   const Int_t np = 5;
   Double_t x[np]       = {0, 1, 2, 3, 4};
   Double_t y[np]       = {0, 2, 4, 1, 3};
   Double_t exl[np]     = {0.3, 0.3, 0.3, 0.3, 0.3};
   Double_t exh[np]     = {0.3, 0.3, 0.3, 0.3, 0.3};
   Double_t eylstat[np] = {1, 0.5, 1, 0.5, 1};
   Double_t eyhstat[np] = {0.5, 1, 0.5, 1, 2};
   Double_t eylsys[np]  = {0.5, 0.4, 0.8, 0.3, 1.2};
   Double_t eyhsys[np]  = {0.6, 0.7, 0.6, 0.4, 0.8};
   auto gme = new TGraphMultiErrors("gme", "TGraphMultiErrors Example", np, x, y, exl, exh, eylstat, eyhstat);
   gme->AddYError(np, eylsys, eyhsys);
   gme->Draw("APS ; Z ; 5 s=0.5");

The results show:

error:unknown type name 'TGraphMultiErrors'**

Any comment and suggestion is appreciated.

Best wishes

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Currently, I add the class TGraphMultiErrors.cxx and head file TGraphMultiErrors.h in my function. The function is no error. But the plot only show one marker, no stat line and no systematic line.

The example works fine on ROOT 6.22. Maybe your version is too old; this graph was implemented sometime last year (see this), so try with the latest version.

Nice. Thanks a lot. The problem indeed comes from the old version. I run the macro using the latest root 6.22 version again, and the it works perfect.


Hi dastudillo,
Do you know how to add “same” option to TGraphMultiErrors
Just like ->Draw(“Psame”);
insert into:
gme->Draw("APS ; Z ; 5 s=0.5");
Because I had set a proper x, y range and other plots.


Just don’t draw the axes again (remove A):

gme->Draw("PS same ; Z ; 5 s=0.5");

it also works without adding “same” but doesn’t hurt to put it.

Perfect. Thanks a lot. I am appreciated for your patient.
In addition, could I change the current option to have a fixed width of systematic box, just like below, and have a statistical range (now just including a line, not haveing the short horizontal line)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.