Skip to content

Commit c7c5ade

Browse files
Refactor grouped_bar orientation logic using shared common_kwargs
1 parent 9fffd16 commit c7c5ade

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,12 +3379,16 @@ def grouped_bar(self, heights, *, positions=None, group_spacing=1.5, bar_spacing
33793379
):
33803380
lefts = (group_centers - 0.5 * group_distance + margin_abs
33813381
+ i * (bar_width + bar_spacing_abs))
3382+
common_kwargs = dict(
3383+
align="edge",
3384+
label=label,
3385+
color=color,
3386+
hatch=hatch_pattern
3387+
)
33823388
if orientation == "vertical":
3383-
bc = self.bar(lefts, hs, width=bar_width, align="edge",
3384-
label=label, color=color, hatch=hatch_pattern, **kwargs)
3389+
bc = self.bar(lefts, hs, width=bar_width, **common_kwargs, **kwargs)
33853390
else:
3386-
bc = self.barh(lefts, hs, height=bar_width, align="edge",
3387-
label=label, color=color, hatch=hatch_pattern,**kwargs)
3391+
bc = self.barh(lefts, hs, height=bar_width, **common_kwargs, **kwargs)
33883392
bar_containers.append(bc)
33893393

33903394
if tick_labels is not None:

0 commit comments

Comments
 (0)