-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
IndexError thrown by pyplot.legend() when plotting empty bar chart with label #13003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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
In the case where there is no children from the original handler
Similarly, we could first check the length of Could anyone please advise if this is the correct approach to this particular issue? |
@choyiny I'd rather do def update_from_first_child(tgt, src):
first_child = next(iter(src.get_children()), None)
tgt.update_from(first_child) And handle |
Uh oh!
There was an error while loading. Please reload this page.
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: