@@ -2366,6 +2366,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23662366 color = self ._get_patches_for_fill .get_next_color ()
23672367 edgecolor = kwargs .pop ('edgecolor' , None )
23682368 linewidth = kwargs .pop ('linewidth' , None )
2369+ hatch = kwargs .pop ('hatch' , None )
23692370
23702371 # Because xerr and yerr will be passed to errorbar, most dimension
23712372 # checking and processing will be left to the errorbar method.
@@ -2427,9 +2428,9 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24272428 if yerr is not None :
24282429 yerr = self ._convert_dx (yerr , y0 , y , self .convert_yunits )
24292430
2430- x , height , width , y , linewidth = np .broadcast_arrays (
2431+ x , height , width , y , linewidth , hatch = np .broadcast_arrays (
24312432 # Make args iterable too.
2432- np .atleast_1d (x ), height , width , y , linewidth )
2433+ np .atleast_1d (x ), height , width , y , linewidth , hatch )
24332434
24342435 # Now that units have been converted, set the tick locations.
24352436 if orientation == 'vertical' :
@@ -2440,6 +2441,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24402441 tick_label_position = y
24412442
24422443 linewidth = itertools .cycle (np .atleast_1d (linewidth ))
2444+ hatch = itertools .cycle (np .atleast_1d (hatch ))
24432445 color = itertools .chain (itertools .cycle (mcolors .to_rgba_array (color )),
24442446 # Fallback if color == "none".
24452447 itertools .repeat ('none' ))
@@ -2476,14 +2478,16 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24762478 bottom = y
24772479
24782480 patches = []
2479- args = zip (left , bottom , width , height , color , edgecolor , linewidth )
2480- for l , b , w , h , c , e , lw in args :
2481+ args = zip (left , bottom , width , height , color , edgecolor , linewidth ,
2482+ hatch )
2483+ for l , b , w , h , c , e , lw , htch in args :
24812484 r = mpatches .Rectangle (
24822485 xy = (l , b ), width = w , height = h ,
24832486 facecolor = c ,
24842487 edgecolor = e ,
24852488 linewidth = lw ,
24862489 label = '_nolegend_' ,
2490+ hatch = htch ,
24872491 )
24882492 r .update (kwargs )
24892493 r .get_path ()._interpolation_steps = 100
0 commit comments