Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bd7038a

Browse filesBrowse files
committed
MAINT Better error message for number of colors versus number of datasets
1 parent 064e92c commit bd7038a
Copy full SHA for bd7038a

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6537,7 +6537,10 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
65376537
else:
65386538
color = mcolors.to_rgba_array(color)
65396539
if len(color) != nx:
6540-
raise ValueError("color kwarg must have one color per dataset")
6540+
error_message = (
6541+
"color kwarg must have one color per data sets. %d data "
6542+
"sets and %d colors were provided" % (len(color), nx))
6543+
raise ValueError(error_message)
65416544

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.