You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "test.py", line 3, in <module>
plt.legend()
File "/opt/conda/lib/python3.6/site-packages/matplotlib/pyplot.py", line 3823, in legend
ret = gca().legend(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 557, in legend
self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/matplotlib/legend.py", line 699, in __init__
self._init_legend_box(handles, labels, markerfirst)
File "/opt/conda/lib/python3.6/site-packages/matplotlib/legend.py", line 954, in _init_legend_box
fontsize, handlebox))
File "/opt/conda/lib/python3.6/site-packages/matplotlib/legend_handler.py", line 119, in legend_artist
fontsize, handlebox.get_transform())
File "/opt/conda/lib/python3.6/site-packages/matplotlib/legend_handler.py", line 303, in create_artists
self.update_prop(p, orig_handle, legend)
File "/opt/conda/lib/python3.6/site-packages/matplotlib/legend_handler.py", line 76, in update_prop
self._update_prop(legend_handle, orig_handle)
File "/opt/conda/lib/python3.6/site-packages/matplotlib/legend_handler.py", line 69, in _update_prop
self._update_prop_func(legend_handle, orig_handle)
File "/opt/conda/lib/python3.6/site-packages/matplotlib/legend_handler.py", line 42, in update_from_first_child
tgt.update_from(src.get_children()[0])
IndexError: list index out of range
Hi, this is my first time contributing to a large scale open source project, please do pardon my beginner knowledge.
The error originates the function update_from_first_child in legend_handler, which is called by the legend handler of BarContainer defined at legend.py:682
Bug report
Bug summary
When I try to create bar chart with no data, and add a label to this chart, IndexError will be raised when trying to create legend for this plot
Code for reproduction
Actual outcome
Expected outcome
Matplotlib version
print(matplotlib.get_backend())
): module://backend_interaggThe text was updated successfully, but these errors were encountered: