如何将注释文本放在水平条形图的最左侧?

时间:2021-01-05 05:42:24

标签: python matplotlib annotations data-visualization bar-chart

我有这样的注释代码

for p in ax.patches:
    ax.annotate("Total: %.1f" % p.get_width(), xy=(p.get_width(), p.get_y()+p.get_height()/2),
            xytext=(0, 0), textcoords='offset points',ha='center', va="center")

假设可视化结果是这样的: enter image description here

但我希望文本注释像这样位于水平图表的底部(想象这是一个水平条形图): enter image description here

我写的代码应该改变什么?

0 个答案:

没有答案