File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
galleries/examples/lines_bars_and_markers Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change 1919 'Flipper Length' : (189.95 , 195.82 , 217.19 ),
2020}
2121
22- x = np .arange (len (species )) # the label locations
23- width = 0.25 # the width of the bars
24- multiplier = 0
25-
2622fig , ax = plt .subplots (layout = 'constrained' )
2723
28- for attribute , measurement in penguin_means .items ():
29- offset = width * multiplier
30- rects = ax .bar (x + offset , measurement , width , label = attribute )
31- ax .bar_label (rects , padding = 3 )
32- multiplier += 1
24+ res = ax .grouped_bar (penguin_means , tick_labels = species , group_spacing = 1 )
25+ for container in res .bar_containers :
26+ ax .bar_label (container , padding = 3 )
3327
34- # Add some text for labels, title and custom x-axis tick labels , etc.
28+ # Add some text for labels, title, etc.
3529ax .set_ylabel ('Length (mm)' )
3630ax .set_title ('Penguin attributes by species' )
37- ax .set_xticks (x + width , species )
3831ax .legend (loc = 'upper left' , ncols = 3 )
3932ax .set_ylim (0 , 250 )
4033
You can’t perform that action at this time.
0 commit comments