# bar_label()

*noun*

say it: **“BAR LAY-bul”** **/ˈbɑr ˈleɪbəl/**

A matplotlib method that writes each bar's number at the end of its bar on a bar chart.

## What does **bar_label()** do in matplotlib?

**bar_label()** is the matplotlib Axes method that writes each bar's value at the end of its bar, so a reader gets
the exact number as well as the comparison. It takes the bars that `ax.bar` or `ax.barh` hands back.

```python
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
bars = ax.bar(["Vanilla", "Mint Chip", "Peach"], [4210, 3875, 1940])
ax.bar_label(bars)   # writes 4210, 3875 and 1940 at the top of the bars
```

## In a sentence

- “**bar_label()** wrote each flavor's scoops at the top of its bar.”
- “She added **bar_label()** so the owner could read the exact counts.”

Level: Journeyman · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/bar-label
