Hi,
I want to plot two TF1
and one TGraph
at the same plot, but when I add one TF1
the TGraph
disappears:
void draw_bounds(){
gStyle->SetCanvasPreferGL(true);
TCanvas* c1 = new TCanvas("C","canvas",1920/2,1080/2);
c1->SetGrid();
TF1* func1 = new TF1("ctzi", "100-0.01*x+8.89*pow(x,2)", -3,3);
TF1* func2 = new TF1("ctwi", "100+0.02*x+11.6*pow(x,2)", -3,3);
func1->GetXaxis()->SetTitle("WC");
func1->SetTitle("");
func1->GetYaxis()->SetTitle("#sigma/#sigma_{SM} (%)");
func1->SetLineColor(kRed);
func2->SetLineColor(kBlue);
func1->SetLineWidth(2);
func2->SetLineWidth(2);
TLegend* legend = new TLegend(0.1, 0.75, 0.2, 0.9);
legend->AddEntry(func1, "ctzi","l");
legend->AddEntry(func2, "ctwi","l");
TGraph *grshade = new TGraph();
int n = 1000;
double x[n];
for (int i=0;i<n;i++) {
x[i] = -3.0+3.0*2.0*i/n;
}
for(int i=0;i<n;i++){
grshade->SetPoint(i,x[i],110);
grshade->SetPoint(n+i,x[n-i-1],90);
}
grshade->SetFillColorAlpha(kRed, 0.5);
grshade->Draw("af");
func1->Draw();
//func2->Draw("SAME");
//legend->Draw();
}
ROOT Version: 6.24/06
Platform: Windows Subsystem for Linux (Debian)
Compiler: Not Provided