@@ -1980,9 +1980,6 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
1980
1980
edgecolor = kwargs .pop ('edgecolor' , None )
1981
1981
linewidth = kwargs .pop ('linewidth' , None )
1982
1982
1983
- tick_label = kwargs .pop ('tick_label' , None )
1984
- label_ticks_flag = tick_label is not None
1985
-
1986
1983
# Because xerr and yerr will be passed to errorbar,
1987
1984
# most dimension checking and processing will be left
1988
1985
# to the errorbar method.
@@ -1998,6 +1995,7 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
1998
1995
orientation = kwargs .pop ('orientation' , 'vertical' )
1999
1996
log = kwargs .pop ('log' , False )
2000
1997
label = kwargs .pop ('label' , '' )
1998
+ tick_labels = kwargs .pop ('tick_label' , None )
2001
1999
2002
2000
def make_iterable (x ):
2003
2001
if not iterable (x ):
@@ -2013,7 +2011,6 @@ def make_iterable(x):
2013
2011
_bottom = bottom
2014
2012
bottom = make_iterable (bottom )
2015
2013
linewidth = make_iterable (linewidth )
2016
- tick_label = make_iterable (tick_label )
2017
2014
2018
2015
adjust_ylim = False
2019
2016
adjust_xlim = False
@@ -2058,8 +2055,6 @@ def make_iterable(x):
2058
2055
2059
2056
if len (linewidth ) < nbars :
2060
2057
linewidth *= nbars
2061
- if len (tick_label ) < nbars :
2062
- tick_label *= nbars
2063
2058
2064
2059
if color is None :
2065
2060
color = [None ] * nbars
@@ -2092,9 +2087,6 @@ def make_iterable(x):
2092
2087
if len (bottom ) != nbars :
2093
2088
raise ValueError ("incompatible sizes: argument 'bottom' "
2094
2089
"must be length %d or scalar" % nbars )
2095
- if len (tick_label ) != nbars :
2096
- raise ValueError ("incompatible sizes: argument 'tick_label' "
2097
- "must be length %d or string" % nbars )
2098
2090
2099
2091
patches = []
2100
2092
@@ -2190,9 +2182,16 @@ def make_iterable(x):
2190
2182
bar_container = BarContainer (patches , errorbar , label = label )
2191
2183
self .add_container (bar_container )
2192
2184
2193
- if label_ticks_flag :
2185
+ if tick_labels is not None :
2186
+ tick_labels = make_iterable (tick_labels )
2187
+ if not is_sequence_of_strings (tick_labels ):
2188
+ raise ValueError ("tick_label must be a sequence of strings" )
2189
+ if len (tick_labels ) != tick_label_position :
2190
+ raise ValueError ("incompatible sizes: argument 'tick_label' "
2191
+ "must be length %d or string" % nbars )
2192
+
2194
2193
tick_label_axis .set_ticks (tick_label_position )
2195
- tick_label_axis .set_ticklabels (tick_label )
2194
+ tick_label_axis .set_ticklabels (tick_labels )
2196
2195
2197
2196
return bar_container
2198
2197
0 commit comments