@@ -2262,7 +2262,7 @@ def _convert_dx(dx, x0, xconv, convert):
22622262
22632263 @_preprocess_data ()
22642264 @_docstring .dedent_interpd
2265- def bar (self , x , height , width = 0.8 , bottom = None , * , align = "center" ,
2265+ def bar (self , x , height , width = 0.8 , bottom = None , * , align = "center" , edgecolor = "black" ,
22662266 ** kwargs ):
22672267 r"""
22682268 Make a bar plot.
@@ -2320,6 +2320,8 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23202320 edgecolor : color or list of color, optional
23212321 The colors of the bar edges.
23222322
2323+ hatchcolor : color of the hatch inside the bar
2324+
23232325 linewidth : float or array-like, optional
23242326 Width of the bar edge(s). If 0, don't draw edges.
23252327
@@ -2386,6 +2388,9 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23862388 edgecolor = kwargs .pop ('edgecolor' , None )
23872389 linewidth = kwargs .pop ('linewidth' , None )
23882390 hatch = kwargs .pop ('hatch' , None )
2391+ hatchcolor = kwargs .get ('hatchcolor' , None )
2392+ if hatchcolor and not edgecolor :
2393+ edgecolor = "black"
23892394
23902395 # Because xerr and yerr will be passed to errorbar, most dimension
23912396 # checking and processing will be left to the errorbar method.
@@ -2489,6 +2494,14 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24892494 # Fallback if edgecolor == "none".
24902495 itertools .repeat ('none' ))
24912496
2497+ if hatchcolor is None :
2498+ hatchcolor = itertools .repeat (None )
2499+ else :
2500+ hatchcolor = itertools .chain (
2501+ itertools .cycle (mcolors .to_rgba_array (hatchcolor )),
2502+ # Fallback if edgecolor == "none".
2503+ itertools .repeat ('none' ))
2504+
24922505 # We will now resolve the alignment and really have
24932506 # left, bottom, width, height vectors
24942507 _api .check_in_list (['center' , 'edge' ], align = align )
0 commit comments