@@ -105,6 +105,10 @@ def __init__(self, *,
105
105
facecolor.
106
106
facecolors : :mpltype:`color` or list of colors, default: :rc:`patch.facecolor`
107
107
Face color for each patch making up the collection.
108
+ hatchcolors : :mpltype:`color` or list of colors, default: :rc:`hatch.color`
109
+ Hatch color for each patch making up the collection. The special
110
+ value 'edge' can be passed to make the hatchcolor match the
111
+ edgecolor.
108
112
linewidths : float or list of floats, default: :rc:`patch.linewidth`
109
113
Line width for each patch making up the collection.
110
114
linestyles : str or tuple or list thereof, default: 'solid'
@@ -754,7 +758,7 @@ def _get_default_antialiased(self):
754
758
755
759
def set_color (self , c ):
756
760
"""
757
- Set both the edgecolor and the facecolor .
761
+ Sets the edgecolor, facecolor and hatchcolor .
758
762
759
763
Parameters
760
764
----------
@@ -767,6 +771,7 @@ def set_color(self, c):
767
771
"""
768
772
self .set_facecolor (c )
769
773
self .set_edgecolor (c )
774
+ self .set_hatchcolor (c )
770
775
771
776
def _get_default_facecolor (self ):
772
777
# This may be overridden in a subclass.
@@ -811,7 +816,7 @@ def _get_default_edgecolor(self):
811
816
812
817
def get_hatchcolor (self ):
813
818
if cbook ._str_equal (self ._hatchcolors , 'edge' ):
814
- if self .get_edgecolor (). size == 0 :
819
+ if len ( self .get_edgecolor ()) == 0 :
815
820
return mpl .colors .to_rgba_array (self ._get_default_edgecolor (),
816
821
self ._alpha )
817
822
return self .get_edgecolor ()
@@ -852,7 +857,7 @@ def set_edgecolor(self, c):
852
857
853
858
def _set_hatchcolor (self , c ):
854
859
c = mpl ._val_or_rc (c , 'hatch.color' )
855
- if c == 'edge' :
860
+ if cbook . _str_equal ( c , 'edge' ) :
856
861
self ._hatchcolors = 'edge'
857
862
else :
858
863
self ._hatchcolors = mcolors .to_rgba_array (c , self ._alpha )
@@ -868,8 +873,6 @@ def set_hatchcolor(self, c):
868
873
The collection hatchcolor(s). If a sequence, the patches cycle
869
874
through it.
870
875
"""
871
- if cbook ._str_equal (c , 'edge' ):
872
- c = 'edge'
873
876
self ._original_hatchcolor = c
874
877
self ._set_hatchcolor (c )
875
878
@@ -888,6 +891,7 @@ def set_alpha(self, alpha):
888
891
artist .Artist ._set_alpha_for_array (self , alpha )
889
892
self ._set_facecolor (self ._original_facecolor )
890
893
self ._set_edgecolor (self ._original_edgecolor )
894
+ self ._set_hatchcolor (self ._original_hatchcolor )
891
895
892
896
set_alpha .__doc__ = artist .Artist ._set_alpha_for_array .__doc__
893
897
0 commit comments