@@ -2574,10 +2574,27 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2574
2574
height = self ._convert_dx (height , y0 , y , self .convert_yunits )
2575
2575
if yerr is not None :
2576
2576
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
2581
2598
2582
2599
# Now that units have been converted, set the tick locations.
2583
2600
if orientation == 'vertical' :
0 commit comments