[SciPy-user] autolabels for barcharts

Timmie timmichelsen@gmx-topmail...
Thu Mar 5 08:49:16 CST 2009


Hello,
I have a question regarding autolabels for bar charts.

It seems that the pie charts have already incorporated such a functionality [1].
Is there any reason why this isn't built in the bar chart function [2]?


The function I am referring to is:

def autolabel(rects):
    # attach some text labels
    for rect in rects:
        #~ print rect
        height = rect.get_height()
        print height
        ax.text(rect.get_x()+rect.get_width()/2., 1.05*height, '%d'%int(height),
                ha='center', va='bottom')

Thanks in advance for the clarification,
Timmie


[1]
http://matplotlib.sourceforge.net/examples/pylab_examples/pie_demo.html?highlight=autolabel

[2]
http://matplotlib.sourceforge.net/examples/api/barchart_demo.html?highlight=autolabel




More information about the SciPy-user mailing list