1

I put the following code :

ratio_result_selected_country.loc['3/17/20':].plot.line(figsize=(17,7), grid = True)

and the result is : enter image description here

is it possible to add label directly like this :

enter image description here

ax  = ratio_result_selected_country.loc['3/17/20':].plot(figsize=(17,7), grid = True)
for line , name in zip (ax.lines ,ratio_result_selected_country.columns ):
    y = line.get_ydata()[-1]
    ax.annotate(name,xy=(1,y),xytext=(6,0),color=line.get_color(),
               xycoords = ax.get_yaxis_transform(),textcoords ="offset points",
                size = 14, va="center"
               )

plt.show()
  • 2
    Here you go, use ax.annotate: https://stackoverflow.com/questions/49237522/how-to-annotate-end-of-lines-using-python-and-matplotlib – sander May 07 '20 at 08:55
  • Thank you so much for the link : – Julio Ludovic Ramihone May 07 '20 at 15:06
  • [How to annotate end of lines using python and matplotlib?](https://stackoverflow.com/questions/49237522/how-to-annotate-end-of-lines-using-python-and-matplotlib) seems to answer to question. Please vote to close this question as a duplicate. – Trenton McKinney May 08 '20 at 21:48

0 Answers0