1-week old newbie here. I've successfully created a chart showing states on the x-axis and rate on the y-axis. I'm struggling trying to annotate the max value, e.g. Maine @ 1.10%. Below works fine, but it's manual in that I'm plugging in the coordinates:
ax.annotate('Biggest Concern',
xy=(11.8, 1), xycoords='data',
xytext=(-15, 25), textcoords='offset points',
arrowprops=dict(facecolor='black', shrink=0.05),
horizontalalignment='right', verticalalignment='bottom')
When I try this approach:
x=np.array(df_Readmit['State'])
y=np.array(df_Readmit['DeltaReadmitRate'])
ax.annotate('local max', xy=(xmax, ymax), xytext=(xmax, ymax+5),
arrowprops=dict(facecolor='black', shrink=0.05),)
it errors out:
can only concatenate str (not "int") to str
I tried wrapping str() around the ymax+5 and I receive the same message. Below is the almost finished product, just missing the annotations. I assume need to do something w/the index to make the states an int.