8000 MAINT Better error message for number of colors versus number of data… by NelleV · Pull Request #11876 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

MAINT Better error message for number of colors versus number of data… #11876

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

Merged
merged 2 commits into from
Aug 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6537,7 +6537,10 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
else:
color = mcolors.to_rgba_array(color)
if len(color) != nx:
raise ValueError("color kwarg must have one color per dataset")
error_message = (
"color kwarg must have one color per data set. %d data "
"sets and %d colors were provided" % (len(color), nx))
raise ValueError(error_message)

# If bins are not specified either explicitly or via range,
# we need to figure out the range required for all datasets,
Expand Down
0