Now I just want to plot a line graph based on two numpy arrays. My x and y are both two (150,1) arrays. After running the following code:
plt.plot(x,y)
What I get is: Line graph based on two numpy arrays
Hence I am so confused. What do those connected lines represent? I just want one line which goes through all of the points. Any help would be appreciated!
For the dataset, X is just a fixed (150,1) numpy array and y is computed based on the following polynomial function:
def PolyCoefficients(x, coeffs):
""" Returns a polynomial for ``x`` values for the ``coeffs`` provided.
The coefficients must be in ascending order (``x**0`` to ``x**o``).
"""
o = len(coeffs)
y = []
for i in range(len(x)):
value = 0
for j in range(o):
value += coeffs[j]*x[i]**j
y.append(value)
return y
The coefficients have been computed and what I want is just a line go through each point of (x,y)