I am trying to add text inside the below graph using figtext() but the written code below does not work. I appreciate any help.
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
x = np.array([0.00161, 0.00322, 0.00483, 0.00645, 0.00806])
y = np.array([0.005, 0.006, 0.007, 0.008, 0.013])
a, b = np.polyfit(x, y, 1)
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
slope = round(slope, 4)
intercept = round(intercept, 4)
r_value = r_value
r_squared = round(r_value ** 2, 4)
plt.scatter(x, y, color='purple')
plt.figtext(-25, 25, f"y={slope}x+{intercept}")
plt.figtext(-25, 25, f"R^2={r_squared}")
plt.text(1, 17, 'y = ' + '{:.2f}'.format(b) + ' + {:.2f}'.format(a) + 'x', size=14)
plt.xlabel("Concentration")
plt.ylabel("Absorbance")
plt.title("Phosphorus Calibration Curve")
plt.plot(x, a*x+b, color='steelblue', linestyle='--', linewidth=2)
plt.show()