Retrieve yerr value from bar object in matplotlib

Viewed 1272

How can I retrieve a yerr value from an ax.bar object? A bar chart is created with a single line, each parameter of the ax.bar() is a collection, including the yerr value.

bar_list = ax.bar(x_value_list, y_value_list, color=color_list,
                  tick_label=columns, yerr=confid_95_list, align='center')

Later on, I want to be able to retrieve both the y value as well as the yerr value of each individual bar in the chart. I iterate through the bar_list collection and I can retrieve the y value, but I don't know how to retrieve the yerr value.

Getting the y value looks like this:

for bar in bar_list:
    y_val = bar.get_height()

How can I get the yerr? Is there something like a bar.get_yerr() method? (It isn't bar.get_yerr()) I would like to be able to:

for bar in bar_list:
    y_err = bar.get_yerr()
1 Answers
Related