This is what my bar chart looks like ..
[![mychart][1]][1]
I wish I could format the axhline text with a thousand separator. Is there a way to do this? I have looked at FuncFormatter(lambda x, pos: "[%.2f]" % x) so I wonder if I could do it within plt.text somehow?
my code for the axhline:
yline = plt.axhline(y, zorder=0, color='indigo')
ytext = plt.text(1995.05, y, 'y = %d' %y, bbox=dict(fc='white',ec='red'))
I have tried as
y_text = plt.text(1995.05, y,'{:,.2f}'.format(y), bbox=dict(fc='white',ec='red'))
and this does not work.
y_text = plt.text(1995.05, y, f'{y:,%d}')
---> 53 ytext = plt.text(1995.05, y, f'{y:,%d}', bbox=dict(fc='white',ec='darkviolet'))
54
55
ValueError: Invalid format specifier.
[1]: https://i.stack.imgur.com/puKDC.jpg