import ROOT
from array import array
import math
x = range(1,11)
xerrs = [0]*10
y = [131.4,227.1,245,331.2,386.9,464.9,476.3,512.2,510.8,532.9]
yerrs = [math.sqrt(i) for i in y]
graph = ROOT.TGraphErrors(len(x),array('d',x),array('d',y),array('d',xerrs),array('d',yerrs))
graph.Fit("pol1""pol2","S")
c = ROOT.TCanvas("test","test",800,600)
graph.Draw("AP")
c.Draw()
Welcome to JupyROOT 6.07/03
****************************************
Minimizer is Linear
Chi2 = 33 8.44322817
NDf = 87
p0 = 11046.3256629 +/- 916.880040838
p1 = 48 88.7638194 +/- 18.936209565
p2 = -3.91398 +/- 0.78028
(clearly a bad fit if you count the degrees of freedom) and a nice plot is produced: