@@ -2366,6 +2366,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2366
2366
color = self ._get_patches_for_fill .get_next_color ()
2367
2367
edgecolor = kwargs .pop ('edgecolor' , None )
2368
2368
linewidth = kwargs .pop ('linewidth' , None )
2369
+ hatch = kwargs .pop ('hatch' , None )
2369
2370
2370
2371
# Because xerr and yerr will be passed to errorbar, most dimension
2371
2372
# 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",
2427
2428
if yerr is not None :
2428
2429
yerr = self ._convert_dx (yerr , y0 , y , self .convert_yunits )
2429
2430
2430
- x , height , width , y , linewidth = np .broadcast_arrays (
2431
+ x , height , width , y , linewidth , hatch = np .broadcast_arrays (
2431
2432
# Make args iterable too.
2432
- np .atleast_1d (x ), height , width , y , linewidth )
2433
+ np .atleast_1d (x ), height , width , y , linewidth , hatch )
2433
2434
2434
2435
# Now that units have been converted, set the tick locations.
2435
2436
if orientation == 'vertical' :
@@ -2440,6 +2441,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2440
2441
tick_label_position = y
2441
2442
2442
2443
linewidth = itertools .cycle (np .atleast_1d (linewidth ))
2444
+ hatch = itertools .cycle (np .atleast_1d (hatch ))
2443
2445
color = itertools .chain (itertools .cycle (mcolors .to_rgba_array (color )),
2444
2446
# Fallback if color == "none".
2445
2447
itertools .repeat ('none' ))
@@ -2476,14 +2478,16 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2476
2478
bottom = y
2477
2479
2478
2480
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 :
2481
2484
r = mpatches .Rectangle (
2482
2485
xy = (l , b ), width = w , height = h ,
2483
2486
facecolor = c ,
2484
2487
edgecolor = e ,
2485
2488
linewidth = lw ,
2486
2489
label = '_nolegend_' ,
2490
+ hatch = htch ,
2487
2491
)
2488
2492
r .update (kwargs )
2489
2493
r .get_path ()._interpolation_steps = 100
0 commit comments