from numpy import polyfit, array
from matplotlib.pyplot import plot, show, scatter, legend, xlabel, ylabel

U = array( [0 , 1 , 2 , 3 , 4 , 5] )
I = array( [0, 0.011 , 0.019 , 0.033 , 0.041 , 0.049] )

modele = polyfit(I,U,1)
equation = ("U = {} x I + {}".format( format(modele[0],".2E") , format(modele[1],".2E")))

scatter(I,U,marker='+',s=100) # placement des points
plot(I , modele[0]*I+modele[1] , color='red' , label = equation)

xlabel("I (A)")
ylabel("U (V)")
legend()
show()
