Skip to content

Instantly share code, notes, and snippets.

@ubless607
Created March 6, 2023 01:09
Show Gist options
  • Save ubless607/05f66844e3451b9cc50fb092b986e8d3 to your computer and use it in GitHub Desktop.
Save ubless607/05f66844e3451b9cc50fb092b986e8d3 to your computer and use it in GitHub Desktop.
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