Brazil-flag plot using TGraphAsymmError


Please read tips for efficient and successful posting and posting code

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


Hello Root Experts.

I just want to know what to do to this case. I cant draw the yellow-color error bar, it just draw the error bar but didnt fill it with yellow as sen in the image.

. By the way, this is a part of my code that makes the drawing.

auto gr = new TGraphAsymmErrors(n,x,y,exl,exh,eyl,eyh);
// gr->SetTitle(“TGraphAsymmErrors Example”);
gr->GetYaxis()->SetRangeUser(0.000000001, 0.001);
gr->SetFillColor(kGreen);
gr->Draw(“a3”);

auto gr2 = new TGraphAsymmErrors(n,x,y,exl,exh,eyl2,eyh2);
gr2->GetYaxis()->SetRangeUser(0.000000001, 0.001);
gr2->SetFillColor(kYellow);
gr2->Draw(“same”);

auto gr3 = new TGraph(n, x,cross_section_BL );
gr3->GetYaxis()->SetRangeUser(0.000000001, 0.001);
gr3->SetLineColor(kRed);
gr3->SetLineWidth(5);
gr3->Draw(“same”);

The gr2 supposedly is the yellow error bar but it cannot be seen, i think it has something to do with the option in DRAW().

Cheers.
Marlon

Try the option “2”:

gr2->Draw(“2,same”);

https://root.cern/doc/master/classTGraphPainter.html#GP03

Now it become like this,

.

Actually my basis of this is the tutorial in Graph in Root with the following codes,

{

auto c41 = new TCanvas(“c41”,“c41”,200,10,600,400);
double x[] = {0, 1, 2, 3, 4};
double y[] = {0, 2, 4, 1, 3};
double ex[] = {0, 0, 0, 0, 0};
double ey[] = {2, 1, 2, 1, 2};
auto ge = new TGraphErrors(5, x, y, ex, ey);
ge->SetFillColor(kGreen);
ge->Draw(“a3”);

double ey2[] = {1, .5, .9, .6, 1};
auto ge2 = new TGraphErrors(5, x, y, ex, ey2);
ge2->SetFillColor(kYellow);
ge2->Draw(“Same3l”);

}
actually even if i do gr->Draw(Same3l)
this will be the result

Cheers.
Marlon

The macro you posted had mistakes (wrong quotes) it should be:

{

   auto c41 = new TCanvas("c41","c41",200,10,600,400);
   double x[] = {0, 1, 2, 3, 4};
   double y[] = {0, 2, 4, 1, 3};
   double ex[] = {0, 0, 0, 0, 0};
   double ey[] = {2, 1, 2, 1, 2};
   auto ge = new TGraphErrors(5, x, y, ex, ey);
   ge->SetFillColor(kGreen);
   ge->Draw("a3");

   double ey2[] = {1, .5, .9, .6, 1};
   auto ge2 = new TGraphErrors(5, x, y, ex, ey2);
   ge2->SetFillColor(kYellow);
   ge2->Draw("Same3l");

}

and it gives: