是否可以在pandas/matplotlib堆积面积图中放置数据标签(值)?在
在堆积条形图中,我使用下面的
for label in yrplot.patches:
yrplot.annotate(label.get_height(), (label.get_x()+label.get_width()/2.,label.get_y()+label.get_height()/2.),
ha='center', va='center', xytext=(0, 1),
textcoords='offset points')
下面是我如何绘制堆积面积图
^{pr2}$任何线索都将不胜感激。为了说明我的想法,它类似于this图像,但在堆积面积图中(沿着绘图的数据标签,类似于问题中的第一个代码)。在
可以手动将批注添加到堆积面积图中,使用值的累积和来计算标签的y位置。另外,如果堆栈的高度很小,我建议不要绘制注释。在
相关问题 更多 >
编程相关推荐