diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ccccae9db634..ed7552418ae7 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -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,