@@ -2574,10 +2574,27 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
25742574 height = self ._convert_dx (height , y0 , y , self .convert_yunits )
25752575 if yerr is not None :
25762576 yerr = self ._convert_dx (yerr , y0 , y , self .convert_yunits )
2577-
2578- x , height , width , y , linewidth , hatch = np .broadcast_arrays (
2579- # Make args iterable too.
2580- np .atleast_1d (x ), height , width , y , linewidth , hatch )
2577+ try :
2578+ x , height , width , y , linewidth , hatch = np .broadcast_arrays (
2579+ # Make args iterable too.
2580+ np .atleast_1d (x ), height , width , y , linewidth , hatch
2581+ )
2582+ except ValueError as e :
2583+ arg_map = {
2584+ "arg 0" : "'x'" ,
2585+ "arg 1" : "'height'" ,
2586+ "arg 2" : "'width'" ,
2587+ "arg 3" : "'y'" ,
2588+ "arg 4" : "'linewidth'" ,
2589+ "arg 5" : "'hatch'"
2590+ }
2591+ error_message = str (e )
2592+ for arg , name in arg_map .items ():
2593+ error_message = error_message .replace (arg , name )
2594+ if error_message != str (e ):
2595+ raise ValueError (error_message ) from e
2596+ else :
2597+ raise
25812598
25822599 # Now that units have been converted, set the tick locations.
25832600 if orientation == 'vertical' :
0 commit comments