I use the code similar to ConfidenceIntervals.C File Reference. But the output image only contains scatter plot and fitting line. Do you know how to make confidence interval visible?
TCanvas *c1 = new TCanvas(“c1”,“graph”,700,500);
//creat graph
tree->Draw(“Step:Susceptible>>graph”);
graph->GetXaxis()->SetTitle(“Susceptible”);
graph->GetYaxis()->SetTitle(“Step”);
//Create the fitting function
TF1 *fpol = new TF1(“fpol”, “pol1”, -1, 1);
fpol->SetLineWidth(2);
graph->Fit(fpol, “Q”);
/Create a TGraphErrors to hold the confidence intervals/
ngr = tree->GetEntries();
TGraphErrors *grint = new TGraphErrors(ngr);
grint->SetTitle(“Fitted line with .95 conf. band”);
for (i=0; i<ngr; i++)
grint->SetPoint(i, gr->GetX()[i], 0);
/Compute the confidence intervals at the x points of the created graph/
(TVirtualFitter::GetFitter())->GetConfidenceIntervals(grint);
//Draw the graph, the function and the confidence intervals
grint->SetLineColor(kRed);
grint->Draw(“ap”);
graph->SetMarkerStyle(5);
graph->SetMarkerSize(0.7);
graph->Draw(“psame”);