import matplotlib.pyplot as plt
x =np.array([[65, 53, 73, 53, 14, ], [46, 70, 72, 19, 32], [22, 76, 29, 55, 61], [35, 74, 24, 32, 78]])
y =np.array([[900, 785, 969, 681, 206], [632, 850, 941, 326, 487], [334, 963, 430, 784, 769], [487, 954, 351, 461, 856]])
a,b = np.linalg.lstsq(x.transpose(), y.transpose(), rcond=None)[0]
plt.plot(x[0], y, 'go', label='Original data', markersize=10)
plt.plot(x[0], a*x[0] + b, 'r-.', label='Fitted line')
plt.ylabel('υ')
plt.xlabel('κ')
plt.title('Υ vs Κ')
plt.legend(['Original','Least Squares'])
plt.grid(color='k', linestyle=':', linewidth=2)
plt.show()
this is whata i came up with,the problem i suspect is with the arrays.basically i want a plot with a line and markers
question from:
https://stackoverflow.com/questions/66045397/is-there-a-way-to-use-least-squares-for-2-arrays-in-pythonvalueerror-too-many