I have made a plot using plt.plot(xdata,ydata)
And I would like to find the x-coordinate when y coordinate = 125.94937644205281 + 1 (chi-squared+1) from the plot.
And I would also like to show its coordinate.
Is there any method to do that?
Example plot
I have tried locating roots method, but it is taking ages to find the two parameters that cause chi-squared + 1.
If matplotlib does not have any method for finding a specific point on the graph, I think I should use solver.
But I do not know which solver to use and how to use solver...
target = chisq_min + 1
def target_chisq_plus1 (gradient):
    return chisq([gradient], xval, yval, yerr) - target
# Locating Roots
initials = [(a_soln, 0.0121320), (0.0122193, a_soln)] # <- Initial Boundaries for the two parameters causing chisquared + 1
tolerance = 0.01
chisquard_plus_one_solutions = []
while True:
    for initial in initials:
        if target_chisq_plus1(initial[0]) > 0:
            xp = initial[0]
            xn = initial[1]
        else:
            xp = initial[1]
            xn = initial[0]
        next_approximation = (xp + xn) / 2
        if target_chisq_plus1(next_approximation) > 0:
            xp = next_approximation
        else:
            xn = next_approximation
        if abs(target_chisq_plus1(next_approximation)) < tolerance:
            gradient_solutions.append((next_approximation, chisq([next_approximation], xval, yval, yerr)))
            break
But it seems i am trapped in an infinite loop.
 
    