Is there a way besides the graphical calltip function to obtain unknown x values from y? How would I go about coding an input() to obtain an unknown x value?
import numpy as np
from scipy import interpolate
x = np.linspace(0, 20, 5)
x = np.array([0. , 5. , 10., 15., 20.])
y = np.linspace(0.422,0.948, 5, endpoint =False)
y = np.array([0.422, 0.5513, 0.66433, 0.83433, 0.948])
f = interpolate.interp1d(x,y)
ynew = np.arange(0,1, 0.1)
import matplotlib.pyplot as plt
plt.figure()
plt.plot(x,y,'o', ynew,f(ynew), '-')
Here is the link to a video by APmonitor which had the solution. See script below: