What's the best way to extract the x coordinate for a given y value in a plot using Python?

35 Views Asked by At

I have the following graph:

enter image description here

Being Uplot the x axis and Pplot the y axis, when doing

peakPplot =  np.max(Pplot)
Uplot_peak = np. interp(peakPplot, Pplot, Uplot)
print(Uplot_peak)

When I used this instead How to find the corresponding x value for a given y value in a plot I could only get the first value

Uplot_peak reported the last value within y but it is outside the graph as it is in shown

Finding the corresponding x value for a given y value within a graph

0

There are 0 best solutions below