np.poly1d()creates a polynomial. If you built this value, you will only get its coefficient values, of which you have 3. Thus, you effectively create the values -1, 7 and -7.
You want to pass some x values to your polynomial to get the corresponding y values.
p = np.poly1d([-1, 7, -7])
x = np.arange(20)
y = p(x)
plt.plot(x, y)
plt.show()
source
share