Many guides still label a grouped bar chart with a hand-written ax.text() loop. It works, but you do x-position math for every bar. For Matplotlib multiple bar chart labels, the better answer is ax.bar_label(), called once for each group of bars you draw:
bars = ax.bar(x + offset, values, width, label=store)
ax.bar_label(bars, fmt="${:.0f}K", padding=2)
In this tutorial, I’ll show you how to add Matplotlib multiple bar chart labels four ways, then how to put percentages inside the bars and keep crowded labels readable.
The sample data for a labeled multiple bar chart
Every chart below uses one running sample, Maple Street Bakery’s 2026 revenue in thousands of US dollars:
- Boston and Chicago: steady stores between $128K and $189K a quarter.
- Denver: opened in March, so Q1 is only $8.4K. That tiny bar is the tricky one for labels.
I printed the numbers first, using Python 3.12.5 and Matplotlib 3.11.2:
quarters = ["Q1 2026", "Q2 2026", "Q3 2026", "Q4 2026"]
sales = { # revenue in thousand USD
"Boston": [142.6, 151.3, 163.8, 188.2],
"Chicago": [128.9, 137.4, 149.1, 171.5],
"Denver": [8.4, 46.7, 92.3, 118.6], # opened in March
}
totals = [sum(v) for v in zip(*sales.values())]
print(f"{'Store':<9}" + "".join(f"{q[:2]:>9}" for q in quarters))
for store, values in sales.items():
print(f"{store:<9}" + "".join(f"{v:>9.2f}" for v in values))
print(f"{'Total':<9}" + "".join(f"{t:>9.2f}" for t in totals))
print(f"Denver share of Q1: {sales['Denver'][0] / totals[0]:.1%}")
Output:
Store Q1 Q2 Q3 Q4
Boston 142.60 151.30 163.80 188.20
Chicago 128.90 137.40 149.10 171.50
Denver 8.40 46.70 92.30 118.60
Total 279.90 335.40 405.20 478.30
Denver share of Q1: 3.0%

If you need the grouped chart itself explained first, start with creating a multiple bar chart in Matplotlib.
Method 1: Label every bar with bar_label() in a loop (Recommended)
Use this when you build the groups yourself with ax.bar(), which works on any Matplotlib from 3.4 on. Same bakery data, one bar_label() call per store inside the loop:
import matplotlib.pyplot as plt
import numpy as np
# paste quarters and sales from the sample data section
x = np.arange(len(quarters))
width = 0.27
fig, ax = plt.subplots(figsize=(9, 5))
for i, (store, values) in enumerate(sales.items()):
bars = ax.bar(x + (i - 1) * width, values, width, label=store)
ax.bar_label(bars, fmt="${:.0f}K", padding=2, fontsize=8)
ax.set_xticks(x, quarters)
ax.set_ylabel("Revenue (thousand USD)")
ax.set_title("Maple Street Bakery - revenue by store, 2026")
ax.legend(loc="upper left", ncols=3)
ax.set_ylim(0, 215)
plt.tight_layout()
plt.show()

How does this code work?
x + (i - 1) * width shifts Boston left, keeps Chicago centered and moves Denver right. Each ax.bar() returns a BarContainer holding that store’s four bars.
bar_label() reads each bar’s height and writes it at the top. The fmt string "${:.0f}K" turns 142.6 into $143K; that brace style needs Matplotlib 3.7+.
set_xticks(x, quarters) puts the group labels under the middle bar of each group. If those tick labels collide, rotate them as shown in rotating Matplotlib tick labels 45 or 90 degrees.
Method 2: Label a grouped_bar() chart with bar_containers
Matplotlib 3.11 added ax.grouped_bar(), which does the offset math for you. Same dictionary, no NumPy:
import matplotlib.pyplot as plt
# paste quarters and sales from the sample data section
fig, ax = plt.subplots(figsize=(9, 5))
res = ax.grouped_bar(sales, tick_labels=quarters, group_spacing=1.2)
for container in res.bar_containers:
ax.bar_label(container, fmt="${:.0f}K", padding=2, fontsize=8)
ax.set_ylabel("Revenue (thousand USD)")
ax.set_title("Same chart with grouped_bar() - Matplotlib 3.11")
ax.legend(loc="upper left", ncols=3)
ax.set_ylim(0, 215)
plt.tight_layout()
plt.show()
print(len(res.bar_containers), "containers")
Output:
3 containers

How does this code work?
grouped_bar() returns a result object, not bars. Its bar_containers list holds one container per dictionary key, so the script printed 3 containers, one each for Boston, Chicago and Denver.
Important: grouped_bar() is still marked provisional in 3.11, so its arguments may change. The single-series basics are in plotting a bar chart in Matplotlib.
Method 3: Place labels by hand with ax.text() (the old way)
Before bar_label() existed, everyone wrote a loop like this. It’s still handy when one bar needs special text, like calling Denver’s first quarter “New”:
import matplotlib.pyplot as plt
import numpy as np
# paste quarters and sales from the sample data section
x = np.arange(len(quarters))
width = 0.27
fig, ax = plt.subplots(figsize=(9, 5))
for i, (store, values) in enumerate(sales.items()):
bars = ax.bar(x + (i - 1) * width, values, width, label=store)
for bar in bars:
h = bar.get_height()
text = "New" if h < 20 else f"{h:.0f}"
ax.text(bar.get_x() + bar.get_width() / 2, h + 2, text,
ha="center", va="bottom", fontsize=8)
ax.set_xticks(x, quarters)
ax.set_ylabel("Revenue (thousand USD)")
ax.legend(loc="upper left", ncols=3)
ax.set_ylim(0, 215)
plt.tight_layout()
plt.show()

How does this code work?
For every bar, get_x() + get_width() / 2 finds its center, and h + 2 lifts the text two units above the top.
So here’s the catch: the + 2 offset is in data units and breaks when your scale changes; bar_label(labels=...) doesn’t. The Matplotlib bar chart with values guide covers more single-series label styles.
Method 4: Show percentage labels inside the bars
Sometimes the share matters more than the dollars. Same bakery data, now with each store’s share of the quarter inside its bar and the revenue on top:
import matplotlib.pyplot as plt
import numpy as np
# paste quarters and sales from the sample data section
totals = [sum(v) for v in zip(*sales.values())]
x = np.arange(len(quarters))
width = 0.27
fig, ax = plt.subplots(figsize=(9, 5))
for i, (store, values) in enumerate(sales.items()):
bars = ax.bar(x + (i - 1) * width, values, width, label=store)
shares = [f"{v / t:.0%}" for v, t in zip(values, totals)]
ax.bar_label(bars, labels=shares, label_type="center",
color="white", fontsize=8, fontweight="bold")
ax.bar_label(bars, fmt="${:.0f}K", padding=2, fontsize=8)
ax.set_xticks(x, quarters)
ax.set_ylabel("Revenue (thousand USD)")
ax.legend(loc="upper left", ncols=3)
ax.set_ylim(0, 215)
plt.tight_layout()
plt.show()

How does this code work?
labels=shares replaces the heights with your own strings, one per bar. label_type="center" moves them to the middle of each bar, and white bold text keeps them readable on the colors.
A second bar_label() call on the same container adds the edge label. Export the result as shown in saving a Matplotlib chart as a PNG.
How do I label a pandas multiple bar chart?
If your data lives in a DataFrame, df.plot.bar() draws the groups, and ax.containers hands you the bar containers:
import matplotlib.pyplot as plt
import pandas as pd
# paste quarters and sales from the sample data section
df = pd.DataFrame(sales, index=[q[:2] for q in quarters])
ax = df.plot.bar(figsize=(9, 5), rot=0, width=0.8)
for container in ax.containers:
ax.bar_label(container, fmt="%.1f", padding=2, fontsize=8)
ax.set_ylabel("Revenue (thousand USD)")
ax.set_ylim(0, 215)
plt.tight_layout()
plt.show()
print(len(ax.containers), "containers:", list(df.columns))
Output:
3 containers: ['Boston', 'Chicago', 'Denver']
