I had to hack this method due to a TypeError in master. No time for a pull request or unit test
def get_legend_handles_labels(self, legend_handler_map=None):
Return handles and labels for legend
``ax.legend()`` is equivalent to ::
h, l = ax.get_legend_handles_labels()
handles = 
labels = 
for handle in self._get_legend_handles(legend_handler_map):
label = handle.get_label()
#if (label is not None and label != '' and not label.startswith('_')):
if label and not (isinstance(label, basestring) and label.startswith('_')):
return handles, labels
Can you provide some code to reproduce the bug? Also, this doesn't seem equivalent -- if label == '' it will be added to the legend in the new version of your code.
label == ''
I'll go back and try to get you a reproduction later today. Obviously if label is not a string (for me it was an integer) then label == '' fails
Here you go:
ax = plt.gca()
ax.bar(np.arange(10), np.arange(10), label=1910)
Happens if label is an integer
Fixed in #1107.