1010import matplotlib .artist as artist
1111from matplotlib .artist import allow_rasterization
1212import matplotlib .cbook as cbook
13+ from matplotlib .cbook import _string_to_bool
1314import matplotlib .font_manager as font_manager
1415import matplotlib .lines as mlines
1516import matplotlib .patches as mpatches
@@ -802,17 +803,6 @@ def set_tick_params(self, which='major', reset=False, **kw):
802803
803804 @staticmethod
804805 def _translate_tick_kw (kw , to_init_kw = True ):
805- # We may want to move the following function to
806- # a more visible location; or maybe there already
807- # is something like this.
808- def _bool (arg ):
809- if cbook .is_string_like (arg ):
810- if arg .lower () == 'on' :
811- return True
812- if arg .lower () == 'off' :
813- return False
814- raise ValueError ('String "%s" should be "on" or "off"' % arg )
815- return bool (arg )
816806 # The following lists may be moved to a more
817807 # accessible location.
818808 kwkeys0 = ['size' , 'width' , 'color' , 'tickdir' , 'pad' ,
@@ -828,22 +818,22 @@ def _bool(arg):
828818 if 'direction' in kw :
829819 kwtrans ['tickdir' ] = kw .pop ('direction' )
830820 if 'left' in kw :
831- kwtrans ['tick1On' ] = _bool (kw .pop ('left' ))
821+ kwtrans ['tick1On' ] = _string_to_bool (kw .pop ('left' ))
832822 if 'bottom' in kw :
833- kwtrans ['tick1On' ] = _bool (kw .pop ('bottom' ))
823+ kwtrans ['tick1On' ] = _string_to_bool (kw .pop ('bottom' ))
834824 if 'right' in kw :
835- kwtrans ['tick2On' ] = _bool (kw .pop ('right' ))
825+ kwtrans ['tick2On' ] = _string_to_bool (kw .pop ('right' ))
836826 if 'top' in kw :
837- kwtrans ['tick2On' ] = _bool (kw .pop ('top' ))
827+ kwtrans ['tick2On' ] = _string_to_bool (kw .pop ('top' ))
838828
839829 if 'labelleft' in kw :
840- kwtrans ['label1On' ] = _bool (kw .pop ('labelleft' ))
830+ kwtrans ['label1On' ] = _string_to_bool (kw .pop ('labelleft' ))
841831 if 'labelbottom' in kw :
842- kwtrans ['label1On' ] = _bool (kw .pop ('labelbottom' ))
832+ kwtrans ['label1On' ] = _string_to_bool (kw .pop ('labelbottom' ))
843833 if 'labelright' in kw :
844- kwtrans ['label2On' ] = _bool (kw .pop ('labelright' ))
834+ kwtrans ['label2On' ] = _string_to_bool (kw .pop ('labelright' ))
845835 if 'labeltop' in kw :
846- kwtrans ['label2On' ] = _bool (kw .pop ('labeltop' ))
836+ kwtrans ['label2On' ] = _string_to_bool (kw .pop ('labeltop' ))
847837 if 'colors' in kw :
848838 c = kw .pop ('colors' )
849839 kwtrans ['color' ] = c
0 commit comments