I am trying curve fitting in python, and am getting a strange error. I am not sure what is the origin of this error. I have this step when I plot at a step of 1 instead of 0.1. Can someone please point me out why do I get this error.
import numpy as np
from matplotlib import pyplot as plt
coeff = [0.6e-4, 0.48e-3, -0.29e-2, -0.164, -0.400, -0.472, -0.330, -0.057, 0.306, 0.689, 1.061, 1.406, 1.715, 1.986, 2.223, 2.432, 2.616]
Temp = [5, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300]
coeff = [0, 0, 0, -0.164, -0.400, -0.472, -0.330, -0.057, 0.306, 0.689, 1.061, 1.406, 1.715, 1.986, 2.223, 2.432, 2.616]
Temp = [5, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300]
legends = np.polyfit(Temp,coeff,4)[::-1]
T = np.arange(4,300,1)
y = [sum([float(a*x**y) for y,a in enumerate(legends)]) for x in T]
T_ = np.arange(4,300,0.1)
y_ = [sum([a*x**y for y,a in enumerate(legends)]) for x in T_]
plt.figure()
plt.plot(Temp,coeff,"ko")
plt.plot(T,y,"ro")
plt.plot(T_,y_,"go")
plt.show()