In this example I would like to turn off the horizontal error bars on the graph:
TH1F *h = new TH1F(“test”, “test”, 2, 0, 2);
TH1F *h2 = new TH1F(“test2”, “test2”, 2, 0, 2);
h → SetBinContent(1, 1.0);
h → SetBinContent(2, 3.0);
h → SetBinError(1, 0.5);
h → SetBinError(2, 0.8);
h2 → SetBinContent(1, 1.0);
h2 → SetBinContent(2, 2.0);
TGraphErrors * g =new TGraphErrors(h);
g-> SetMarkerStyle(kFullCircle);
g → SetMarkerColor(kBlack);
g → SetLineColor(kRed);
gStyle → SetErrorX(0);
h2 → SetMinimum(0.0);
h2-> SetMaximum(4.0);
h2 → Draw();
g → Draw(“EPSAME”);
I tried to use
gStyle → SetErrorX(0)
for that in vain.
How to do that?
couet
2
void viest(){
gStyle -> SetErrorX(0.);
TH1F *h = new TH1F("test", "test", 2, 0, 2);
TH1F *h2 = new TH1F("test2", "test2", 2, 0, 2);
h->SetBinContent(1, 1.0);
h->SetBinContent(2, 3.0);
h->SetBinError(1, 0.5);
h->SetBinError(2, 0.8);
h2->SetBinContent(1, 1.0);
h2->SetBinContent(2, 2.0);
TGraphErrors * g =new TGraphErrors(h);
g->SetMarkerStyle(kFullCircle);
g->SetMarkerColor(kBlack);
g->SetLineColor(kRed);
h2->SetMinimum(0.0);
h2->SetMaximum(4.0);
h2->Draw();
g->Draw("EPSAME");
}
1 Like
system
Closed
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.