@@ -113,6 +113,7 @@ def __init__(self,
113113 if antialiased is None :
114114 antialiased = mpl .rcParams ['patch.antialiased' ]
115115
116+ self ._hatch_color = None
116117 self ._fill = True # needed for set_facecolor call
117118 if color is not None :
118119 if (edgecolor is not None or facecolor is not None ):
@@ -288,13 +289,18 @@ def set_aa(self, aa):
288289 return self .set_antialiased (aa )
289290
290291 def _set_edgecolor (self , color ):
292+ set_hatch_color = True
291293 if color is None :
292294 if (mpl .rcParams ['patch.force_edgecolor' ] or
293295 not self ._fill or self ._edge_default ):
294296 color = mpl .rcParams ['patch.edgecolor' ]
295297 else :
296298 color = 'none'
299+ set_hatch_color = False
300+
297301 self ._edgecolor = colors .to_rgba (color , self ._alpha )
302+ if set_hatch_color :
303+ self ._hatch_color = self ._edgecolor
298304 self .stale = True
299305
300306 def set_edgecolor (self , color ):
@@ -545,6 +551,14 @@ def draw(self, renderer):
545551
546552 if self ._hatch :
547553 gc .set_hatch (self ._hatch )
554+ if self ._hatch_color is not None :
555+ try :
556+ gc .set_hatch_color (self ._hatch_color )
557+ except AttributeError :
558+ # if we end up with a GC that does not have this method
559+ import warnings
560+ warnings .warn ("Your backend does not have support for "
561+ "setting the hatch color." )
548562
549563 if self .get_sketch_params () is not None :
550564 gc .set_sketch_params (* self .get_sketch_params ())
@@ -4286,6 +4300,14 @@ def draw(self, renderer):
42864300
42874301 if self ._hatch :
42884302 gc .set_hatch (self ._hatch )
4303+ if self ._hatch_color is not None :
4304+ try :
4305+ gc .set_hatch_color (self ._hatch_color )
4306+ except AttributeError :
4307+ # if we end up with a GC that does not have this method
4308+ import warnings
4309+ warnings .warn ("Your backend does not have support for "
4310+ "setting the hatch color." )
42894311
42904312 if self .get_sketch_params () is not None :
42914313 gc .set_sketch_params (* self .get_sketch_params ())
0 commit comments