Hi all,
is there a way to set different style for error bars in a TGraphError?
I have two series of data which share the same x coordinate.
TCanvas* clustSize_graph_extended_errors() {
TCanvas *c1 = new TCanvas("c1","cluster size",1024,768);
TH1F *hr = c1->DrawFrame(-1.5,0.,72.5,6.5);
hr->SetXTitle("tilt angle(#circ)");
hr->SetYTitle("Cluster size");
hr->GetXaxis()->SetTitleSize(0.06);
hr->GetXaxis()->SetTitleOffset(+0.72);
hr->GetYaxis()->SetTitleSize(0.06);
hr->GetYaxis()->SetTitleOffset(+0.72);
Double_t xp[8] = { 0, 5, 10, 20, 30, 45, 60, 70 };
Double_t exp[8] = { 0 };
Double_t yp[8] = { 1.20721, 1.22562, 1.28542, 1.4848, 1.78368, 2.47492,
3.35134, 3.65061 };
Double_t eyp[8] = { 0.562451, 0.551921, 0.567112, 0.61946, 0.622228,
0.749616, 1.37372, 2.22937 };
TGraphErrors* gr = new TGraphErrors(8,xp,yp,exp,eyp);
gr->SetMarkerStyle(3);
gr->SetMarkerSize(2.2);
gr->Draw("P");
Double_t xn[8] = { 0, 5, 10, 20, 30, 45, 60, 70 };
Double_t exn[8] = { 0 };
Double_t yn[8] = { 1.16701, 1.18204, 1.22232, 1.37781, 1.62461, 2.09642,
2.23114, 2.13819 };
Double_t eyn[8] = { 0.492465, 0.48957, 0.502571, 0.57684, 0.612702,
0.784188, 1.24298, 1.43012 };
TGraphErrors* gr2 = new TGraphErrors(8,xn,yn,exn,eyn);
gr2->SetMarkerStyle(22);
gr2->SetMarkerSize(2.2);
gr2->Draw("P");
gr->SetTitle();
TGraphErrors* gr3 = new TGraphErrors(8,xn,yn,exn,eyn);
gr3->Draw("[]");
TLegend *l = new TLegend(0.4,0.75,0.6,0.89);
l->SetFillStyle(0);
l->SetBorderSize(0);
l->AddEntry(gr,"p-Side","lep");
l->AddEntry(gr2,"n-Side","lep");
l->Draw();
TLegend *letter = new TLegend(0.15,0.75,0.25,0.89,"a)");
letter->SetFillStyle(0);
letter->SetBorderSize(0);
letter->Draw();
// gStyle->SetHistMinimumZero();
// gPad->SetGrid();
gPad->SetTicks(1,1);
c1->SaveAs("plots/clustSize-graph-extended-errors.png");
c1->SaveAs("plots/clustSize-graph-extended-errors.eps");
c1->SaveAs("plots/clustSize-graph-extended-errors.pdf");
return c1;
Any help will be really appreciated!
Regards,
Marco