@@ -843,10 +843,35 @@ def update(self, props):
843843 Update the properties of this :class:`Artist` from the
844844 dictionary *prop*.
845845 """
846+ def _update_property (self , k , v ):
847+ """sorting out how to update property (setter or setattr)
848+
849+ Parameters
850+ ----------
851+ k : str
852+ The name of property to update
853+ v : obj
854+ The value to assign to the property
855+ Returns
856+ -------
857+ ret : obj or None
858+ If using a `set_*` method return it's return, else None.
859+ """
860+ k = k .lower ()
861+ # white list attributes we want to be able to update through
862+ # art.update, art.set, setp
863+ if k in {'axes' }:
864+ return setattr (self , k , v )
865+ else :
866+ func = getattr (self , 'set_' + k , None )
867+ if func is None or not six .callable (func ):
868+ raise AttributeError ('Unknown property %s' % k )
869+ return func (v )
870+
846871 store = self .eventson
847872 self .eventson = False
848873 try :
849- ret = [self . _update_property (k , v )
874+ ret = [_update_property (self , k , v )
850875 for k , v in sorted (props .items (), reverse = True )]
851876 finally :
852877 self .eventson = store
@@ -856,36 +881,6 @@ def update(self, props):
856881 self .stale = True
857882 return ret
858883
859- def _update_property (self , k , v ):
860- """helper function for set, update, setp
861-
862- This function takes care of sorting out if this should be done
863- through a `set_*` method or a property.
864-
865- Parameters
866- ----------
867- k : str
868- The property to update
869-
870- v : obj
871- The value to assign to the property
872-
873- Returns
874- -------
875- ret : obj or None
876- If using a `set_*` method return it's return, else return None.
877- """
878- k = k .lower ()
879- # white list attributes we want to be able to update through
880- # art.update, art.set, setp
881- if k in ['axes' ]:
882- return setattr (self , k , v )
883- else :
884- func = getattr (self , 'set_' + k , None )
885- if func is None or not six .callable (func ):
886- raise AttributeError ('Unknown property %s' % k )
887- return func (v )
888-
889884 def get_label (self ):
890885 """
891886 Get the label used for this artist in the legend.
0 commit comments