I want to approximate the Y values of a curve that I've plotted in Matplotlib. Currently, the only values I can get are the X,Y pairs that were inputs to the plot. But how would I approximate the value of a point that wasn't part of the input?
Here's an example:
x = [1,3,5,7]
y = [3,11,27,51]
plt.plot(x,y)
The curve obviously corresponds to Y = X^2 + 2. But imagine we didn't know the exact equation of the curve, and wanted to approximate the Y value for X = 5.5. Is there any way to do that just by the using the Matplotlib graph object? Clearly the blue line goes through the corresponding point for X = 5.5, how can I access the Y value from under the hood of Matplotlib. If I can't, what would be the easiest way to find the Y value for X = 5.5 (imagining that we didn't know the exact equation corresponding to the curve).