Consider the graph and table below. We can see that because the table's data points are ordered top to bottom, the graph's data points, when plotted as connecting lines, connect in the same ordered manner. I am wondering if it is possible to linearly interpolate the ordered data and generate additional point values along the blue lines connecting each point.
Value1 Value2
1 5
4 4
2 6
3 6
plt.plot(df['value1'],df['value2'])
I have attempted to use scipy's 1d interpolator. However, based on my script, scipy does not consider the dataframe's order. Instead it considers each data point unordered and interpolates logically to generate a function. I am wondering if there is a method to obtain additional data from the plot above.
ut=np.array(df['value1'])
vt=np.array(df['value2'])
function=interpolate.interp1d(ut, vt, kind='linear')
new_x = np.linspace(1, 4, num=100, endpoint=True)
plt.plot(new_x,function(new_x),'o')