@@ -1838,6 +1838,10 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
18381838 linewidth; If 0, don't draw edges.
18391839 default: None
18401840
1841+ tick_label : string or array-like, optional
1842+ the tick labels of the bars
1843+ default: None
1844+
18411845 xerr : scalar or array-like, optional
18421846 if not None, will be used to generate errorbar(s) on the bar chart
18431847 default: None
@@ -1908,6 +1912,9 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
19081912 edgecolor = kwargs .pop ('edgecolor' , None )
19091913 linewidth = kwargs .pop ('linewidth' , None )
19101914
1915+ tick_label = kwargs .pop ('tick_label' , None )
1916+ label_ticks_flag = tick_label is not None
1917+
19111918 # Because xerr and yerr will be passed to errorbar,
19121919 # most dimension checking and processing will be left
19131920 # to the errorbar method.
@@ -1938,6 +1945,7 @@ def make_iterable(x):
19381945 _bottom = bottom
19391946 bottom = make_iterable (bottom )
19401947 linewidth = make_iterable (linewidth )
1948+ tick_label = make_iterable (tick_label )
19411949
19421950 adjust_ylim = False
19431951 adjust_xlim = False
@@ -1956,6 +1964,9 @@ def make_iterable(x):
19561964 width *= nbars
19571965 if len (bottom ) == 1 :
19581966 bottom *= nbars
1967+
1968+ tick_label_axis = self .xaxis
1969+ tick_label_position = left
19591970 elif orientation == 'horizontal' :
19601971 self ._process_unit_info (xdata = width , ydata = bottom , kwargs = kwargs )
19611972 if log :
@@ -1971,11 +1982,16 @@ def make_iterable(x):
19711982 left *= nbars
19721983 if len (height ) == 1 :
19731984 height *= nbars
1985+
1986+ tick_label_axis = self .yaxis
1987+ tick_label_position = bottom
19741988 else :
19751989 raise ValueError ('invalid orientation: %s' % orientation )
19761990
19771991 if len (linewidth ) < nbars :
19781992 linewidth *= nbars
1993+ if len (tick_label ) < nbars :
1994+ tick_label *= nbars
19791995
19801996 if color is None :
19811997 color = [None ] * nbars
@@ -2008,6 +2024,9 @@ def make_iterable(x):
20082024 if len (bottom ) != nbars :
20092025 raise ValueError ("incompatible sizes: argument 'bottom' "
20102026 "must be length %d or scalar" % nbars )
2027+ if len (tick_label ) != nbars :
2028+ raise ValueError ("incompatible sizes: argument 'tick_label' "
2029+ "must be length %d or string" % nbars )
20112030
20122031 patches = []
20132032
@@ -2103,6 +2122,10 @@ def make_iterable(x):
21032122 bar_container = BarContainer (patches , errorbar , label = label )
21042123 self .add_container (bar_container )
21052124
2125+ if label_ticks_flag :
2126+ tick_label_axis .set_ticks (tick_label_position )
2127+ tick_label_axis .set_ticklabels (tick_label )
2128+
21062129 return bar_container
21072130
21082131 @docstring .dedent_interpd
@@ -2148,6 +2171,9 @@ def barh(self, bottom, width, height=0.8, left=None, **kwargs):
21482171 width of bar edge(s). If None, use default
21492172 linewidth; If 0, don't draw edges.
21502173
2174+ tick_label : string or array-like, optional, default: None
2175+ the tick labels of the bars
2176+
21512177 xerr : scalar or array-like, optional, default: None
21522178 if not None, will be used to generate errorbar(s) on the bar chart
21532179
0 commit comments