#!/usr/bin/python from ROOT import TGraphErrors, TCanvas, TLegend, TMarker, TLine # inputs = [[0.74991,0.750665,0.998996],[0.74991,0.750665,0.998996], # [0.753227,0.746542,0.996412]] results = [[2.9,2.9,20.2],[1.0,2.7,5.1],[29.1,45.4,38.2]] error = [[3.5,6.0,7.4],[3.2,5.6,6.8],[3.5,6.1,7.5]] expect = [[-1.0,-0.9,12.3],[-1.0,-0.9,12.3],[34.1,41.4,38.2]] c = TCanvas('c1','c1',600,600) c.SetFillColor(0) c.SetGridy() g = TGraphErrors(9) g.SetTitle('; ;Deviation From Expectation') h = [] k = 1 for i in range(len(results)): # h.append(TGraphErrors(len(results[0]))) for j in range(len(results[0])): h.append(TMarker(k, results[i][j] - expect[i][j], 20 + j)) h[-1].SetMarkerColor((j + 1)*2) h[-1].SetMarkerSize(1.5) g.SetPoint(k-1,k,results[i][j] - expect[i][j]) g.SetPointError(k-1,0,error[i][j]) k+=1 g.SetFillColor(0) # g.SetMarkerStyle(20) g.SetLineWidth(2) l = TLegend(0.15,0.15,0.3,0.4) l.AddEntry(h[0],'#rho','p') l.AddEntry(h[1],'#delta','p') l.AddEntry(h[2],'#xi','p') l.SetFillColor(0) g.Draw('ap') for q in h: q.Draw('psame') l1 = TLine(3.5,g.GetHistogram().GetMinimum(), 3.5,g.GetHistogram().GetMaximum()) l1.SetLineStyle(2) l1.SetLineWidth(2) l1.Draw('lsame') l2 = TLine(6.5,g.GetHistogram().GetMinimum(), 6.5,g.GetHistogram().GetMaximum()) l2.SetLineStyle(2) l2.SetLineWidth(2) l2.Draw('lsame') l.Draw('same') au = raw_input()