I have a polynomial function that outputs y from x (comes from a polynomial least squares fit). I tried to plot this to show a polynomial continuous curve as shown in some of the answers here: Plotting a polynomial using Matplotlib and coeffiecients
My code can be reduced down to:
import numpy as np
import matplotlib.pyplot as plt
y = np.array([[-0.02200175],
[-0.20964548],
[ 0.68482722],
[-0.30177928],
[ 0.49887387],
[-0.23443495],
[ 0.62761791],
[ 0.94930752],
[ 0.82429792],
[ 0.20244308]])
x = np.array([[ 0.77123627],
[ 0.84008558],
[-0.39987312],
[-0.85321811],
[ 0.53479747],
[-0.83009557],
[ 0.45752816],
[-0.10422071],
[ 0.30249733],
[-0.66099626]])
plt.plot(x, y)
The output, instead of a continuous curve, is a bunch of lines between the points. Why is this? How can I correct it?