Please read tips for efficient and successful posting and posting code
_ROOT Version:6.26/10
_Platform:Ubuntu 22.04
_Compiler:g++ 11.3
When I use this code below, it works properly.
{
gStyle->SetEndErrorSize(5.0);
// or
//gStyle->SetErrorX(5.0);
TCanvas *c4 = new TCanvas("c4","c4",200,10,600,400);
double x[] = {0, 1, 2, 3, 4};
double y[] = {0, 2, 4, 1, 3};
double ex[] = {0.1, 0.2, 0.3, 0.4, 0.5};
double ey[] = {1, 0.5, 1, 0.5, 1};
TGraphErrors* ge = new TGraphErrors(5, x, y, ex, ey);
ge->Draw("AP");
return c4;
}
I reduce the first point’s ex and ey, the code still draw error bars. And because the small errors, the error bars overlap, which is meaningful that can tell us the errors are very small.
{
gStyle->SetEndErrorSize(5.0);
// or
//gStyle->SetErrorX(5.0);
TCanvas *c4 = new TCanvas("c4","c4",200,10,600,400);
double x[] = {0, 1, 2, 3, 4};
double y[] = {0, 2, 4, 1, 3};
double ex[] = {0.001, 0.2, 0.3, 0.4, 0.5};
double ey[] = {0.001, 0.5, 1, 0.5, 1};
TGraphErrors* ge = new TGraphErrors(5, x, y, ex, ey);
ge->Draw("AP");
return c4;
}
But if I set the style of markers, the error bars of first point disappear, only the mark on the pad. No matter I use SetEndErrorSize
or SetErrorX
.
{
gStyle->SetEndErrorSize(5.0);
// or
//gStyle->SetErrorX(5.0);
TCanvas *c4 = new TCanvas("c4","c4",200,10,600,400);
double x[] = {0, 1, 2, 3, 4};
double y[] = {0, 2, 4, 1, 3};
double ex[] = {0.001, 0.2, 0.3, 0.4, 0.5};
double ey[] = {0.001, 0.5, 1, 0.5, 1};
TGraphErrors* ge = new TGraphErrors(5, x, y, ex, ey);
ge->SetMarkerStyle(23);
ge->Draw("AP");
return c4;
}