@@ -3140,6 +3140,10 @@ def grouped_bar(self, x, heights, *, group_spacing=1.5, bar_spacing=0,
31403140
31413141 %(Rectangle:kwdoc)s
31423142
3143+ Returns
3144+ -------
3145+ A list of `.BarContainer` instances, one for each dataset.
3146+
31433147 """
31443148 if hasattr (heights , 'keys' ):
31453149 if labels is not None :
@@ -3196,24 +3200,26 @@ def grouped_bar(self, x, heights, *, group_spacing=1.5, bar_spacing=0,
31963200
31973201 # place the bars, but only use numerical positions, categorical tick labels
31983202 # are handled separately below
3203+ result = []
31993204 for i , (hs , label , color ) in enumerate (
32003205 zip (heights , labels , colors )):
32013206 lefts = (group_centers - 0.5 * group_distance + margin_abs
32023207 + i * (bar_width + bar_spacing_abs ))
32033208 if orientation == "vertical" :
3204- self .bar (lefts , hs , width = bar_width , align = "edge" ,
3205- label = label , color = color , ** kwargs )
3209+ bc = self .bar (lefts , hs , width = bar_width , align = "edge" ,
3210+ label = label , color = color , ** kwargs )
32063211 else :
3207- self .barh (lefts , hs , height = bar_width , align = "edge" ,
3208- label = label , color = color , ** kwargs )
3212+ bc = self .barh (lefts , hs , height = bar_width , align = "edge" ,
3213+ label = label , color = color , ** kwargs )
3214+ result .append (bc )
32093215
32103216 if tick_labels is not None :
32113217 if orientation == "vertical" :
32123218 self .xaxis .set_ticks (group_centers , labels = tick_labels )
32133219 else :
32143220 self .yaxis .set_ticks (group_centers , labels = tick_labels )
32153221
3216- # TODO: does not return anything for now
3222+ return result
32173223
32183224 @_preprocess_data ()
32193225 def stem (self , * args , linefmt = None , markerfmt = None , basefmt = None , bottom = 0 ,
0 commit comments