@@ -492,14 +492,9 @@ def set_linewidth(self, lw):
492492 ACCEPTS: float or sequence of floats
493493 """
494494 if lw is None :
495- if (self ._edge_default or
496- mpl .rcParams ['_internal.classic_mode' ] or
497- not self ._is_filled ):
498- lw = mpl .rcParams ['patch.linewidth' ]
499- if lw is None :
500- lw = mpl .rcParams ['lines.linewidth' ]
501- else :
502- lw = 0
495+ lw = mpl .rcParams ['patch.linewidth' ]
496+ if lw is None :
497+ lw = mpl .rcParams ['lines.linewidth' ]
503498 # get the un-scaled/broadcast lw
504499 self ._us_lw = self ._get_value (lw )
505500
@@ -644,6 +639,20 @@ def set_color(self, c):
644639 self .set_facecolor (c )
645640 self .set_edgecolor (c )
646641
642+ def _set_facecolor (self , c ):
643+ if c is None :
644+ c = mpl .rcParams ['patch.facecolor' ]
645+
646+ self ._is_filled = True
647+ try :
648+ if c .lower () == 'none' :
649+ self ._is_filled = False
650+ except AttributeError :
651+ pass
652+ self ._facecolors = mcolors .to_rgba_array (c , self ._alpha )
653+ self .stale = True
654+
655+
647656 def set_facecolor (self , c ):
648657 """
649658 Set the facecolor(s) of the collection. *c* can be a
@@ -655,17 +664,9 @@ def set_facecolor(self, c):
655664
656665 ACCEPTS: matplotlib color spec or sequence of specs
657666 """
658- self ._is_filled = True
659- try :
660- if c .lower () == 'none' :
661- self ._is_filled = False
662- except AttributeError :
663- pass
664- if c is None :
665- c = mpl .rcParams ['patch.facecolor' ]
666- self ._facecolors_original = c
667- self ._facecolors = mcolors .to_rgba_array (c , self ._alpha )
668- self .stale = True
667+ self ._original_facecolor = c
668+ self ._set_facecolor (c )
669+
669670
670671 def set_facecolors (self , c ):
671672 """alias for set_facecolor"""
@@ -683,6 +684,23 @@ def get_edgecolor(self):
683684 return self ._edgecolors
684685 get_edgecolors = get_edgecolor
685686
687+ def _set_edgecolor (self , c ):
688+ self ._is_stroked = True
689+ try :
690+ if c .lower () == 'none' :
691+ self ._is_stroked = False
692+ except AttributeError :
693+ pass
694+
695+ try :
696+ if c .lower () == 'face' : # Special case: lookup in "get" method.
697+ self ._edgecolors = 'face'
698+ return
699+ except AttributeError :
700+ pass
701+ self ._edgecolors = mcolors .to_rgba_array (c , self ._alpha )
702+ self .stale = True
703+
686704 def set_edgecolor (self , c ):
687705 """
688706 Set the edgecolor(s) of the collection. *c* can be a
@@ -696,24 +714,14 @@ def set_edgecolor(self, c):
696714
697715 ACCEPTS: matplotlib color spec or sequence of specs
698716 """
699- self ._is_stroked = True
700- try :
701- if c .lower () == 'none' :
702- self ._is_stroked = False
703- except AttributeError :
704- pass
705- try :
706- if c .lower () == 'face' :
707- self ._edgecolors = 'face'
708- self ._edgecolors_original = 'face'
709- return
710- except AttributeError :
711- pass
717+ self ._original_edgecolor = c
712718 if c is None :
713- c = mpl .rcParams ['patch.edgecolor' ]
714- self ._edgecolors_original = c
715- self ._edgecolors = mcolors .to_rgba_array (c , self ._alpha )
716- self .stale = True
719+ if (mpl .rcParams ['patch.force_edgecolor' ] or
720+ not self ._is_filled or self ._edge_default ):
721+ c = mpl .rcParams ['patch.edgecolor' ]
722+ else :
723+ c = 'none'
724+ self ._set_edgecolor (c )
717725
718726 def set_edgecolors (self , c ):
719727 """alias for set_edgecolor"""
@@ -732,18 +740,8 @@ def set_alpha(self, alpha):
732740 except TypeError :
733741 raise TypeError ('alpha must be a float or None' )
734742 artist .Artist .set_alpha (self , alpha )
735- try :
736- self ._facecolors = mcolors .to_rgba_array (
737- self ._facecolors_original , self ._alpha )
738- except (AttributeError , TypeError , IndexError ):
739- pass
740- try :
741- if (not isinstance (self ._edgecolors_original , six .string_types )
742- or self ._edgecolors_original != str ('face' )):
743- self ._edgecolors = mcolors .to_rgba_array (
744- self ._edgecolors_original , self ._alpha )
745- except (AttributeError , TypeError , IndexError ):
746- pass
743+ self ._set_facecolor (self ._original_facecolor )
744+ self ._set_edgecolor (self ._original_edgecolor )
747745
748746 def get_linewidths (self ):
749747 return self ._linewidths
@@ -779,9 +777,9 @@ def update_from(self, other):
779777
780778 artist .Artist .update_from (self , other )
781779 self ._antialiaseds = other ._antialiaseds
782- self ._edgecolors_original = other ._edgecolors_original
780+ self ._original_edgecolor = other ._original_edgecolor
783781 self ._edgecolors = other ._edgecolors
784- self ._facecolors_original = other ._facecolors_original
782+ self ._original_facecolor = other ._original_facecolor
785783 self ._facecolors = other ._facecolors
786784 self ._linewidths = other ._linewidths
787785 self ._linestyles = other ._linestyles
0 commit comments