Created
March 6, 2023 01:09
-
-
Save ubless607/05f66844e3451b9cc50fb092b986e8d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def annot_min(x,y, ax=None): | |
xmax = x[np.argmin(y)] | |
ymax = np.array(y).min() | |
text= "x={:.3f}, y={:.3f}".format(xmax, ymax) | |
if not ax: | |
ax=plt.gca() | |
bbox_props = dict(boxstyle="square,pad=0.3", fc="w", ec="k", lw=0.72) | |
arrowprops=dict(arrowstyle="->",connectionstyle="angle,angleA=0,angleB=60", color='red') | |
kw = dict(xycoords='data',textcoords="axes fraction", | |
arrowprops=arrowprops, bbox=bbox_props, ha="right", va="top") | |
ax.annotate(text, xy=(xmax, ymax), xytext=(0.94,0.96), **kw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment