Annotation of horizontal bar graphs in matplotlib

后端 未结 1 581
囚心锁ツ
囚心锁ツ 2020-12-22 01:23

I need to annotate horizontal bar graphs. I am able to annotate vertical bar graphs using the example shown in matplotlib website but a similar idea for horizonatl doesn\'t

相关标签:
1条回答
  • 2020-12-22 02:15
    def autolabel(rects):
        for rect in rects:
            width = rect.get_width()
            plt.text(1.05*rect.get_width(), rect.get_y()+0.5*rect.get_height(),
                     '%d' % int(width),
                     ha='center', va='center')
    

    0 讨论(0)
提交回复
热议问题