While working on a project for my clients, I’ve found that data visualization is essential for communicating insights effectively. Bar charts, in particular, are a go-to choice for comparing categories. But one thing I always make sure to include is value labels on bars. They make charts instantly clearer and more professional, especially when presenting to stakeholders or clients in the USA.
In this article, I’ll share simple ways to add labels to your Matplotlib bar charts.
Let’ begin.
Methods to Add Labels to Matplotlib Bar Charts in Python
When you look at a bar chart, the height of each bar represents a value. But unless the viewer reads the axis carefully or estimates the value, the exact number might not be obvious. Adding labels on top of or inside the bars removes this guesswork.
From my experience presenting to business teams in the USA, labeled bar charts reduce questions and speed up decision-making. It’s a simple addition that boosts the impact of your visualization.
Method 1: Use bar_label() Function in Matplotlib
Starting with Matplotlib version 3.4.0, there’s a handy built-in function called bar_label() that makes adding labels to bars effortless.
How to Use bar_label()
- Create your bar chart using
plt.bar(). - Use
ax.bar_label()to add labels to the bars. - Customize label positions if needed.
Here’s a quick example showing quarterly sales data for four US regions:
import matplotlib.pyplot as plt
regions = ['Northeast', 'Midwest', 'South', 'West']
sales = [25000, 18000, 30000, 22000]
fig, ax = plt.subplots()
bars = ax.bar(regions, sales, color='skyblue')
ax.bar_label(bars, padding=3, fmt='$%d') # Add dollar sign and padding
ax.set_title('Quarterly Sales by US Region')
ax.set_ylabel('Sales in USD')
plt.show()You can refer to the screenshot below to see the output:

This will display the exact sales figures on top of each bar, formatted with a dollar sign for clarity.
It’s clean, integrated, and doesn’t require manual looping or extra code for positioning. Plus, it supports formatting options like padding, rotation, and custom text.
Read Matplotlib Unknown Projection ‘3d’
Method 2: Add Labels Manually with a Loop
Before bar_label() existed, I often added labels by looping through the bars and using ax.text() to position the labels.
How to Add Labels Manually
- Plot your bars.
- Loop through each bar and get its height.
- Use
ax.text()to place the label on or above the bar.
Example with US state population data:
import matplotlib.pyplot as plt
states = ['California', 'Texas', 'Florida', 'New York']
populations = [39500000, 29000000, 21500000, 19500000]
fig, ax = plt.subplots()
bars = ax.bar(states, populations, color='lightgreen')
for bar in bars:
height = bar.get_height()
ax.text(bar.get_x() + bar.get_width()/2, height,
f'{height/1e6:.1f}M', ha='center', va='bottom')
ax.set_title('Population by State (in millions)')
plt.show()You can refer to the screenshot below to see the output:

Here, I formatted the labels to show millions with one decimal place, which is often easier for American audiences to grasp.
It gives you full control over label formatting and placement. You can adjust the text color, font size, or add conditional formatting based on values.
Check out Matplotlib 2d Surface Plot
Method 3: Place Labels Inside Bars for Better Visual Appeal
Sometimes, placing labels inside the bars (instead of above) looks cleaner, especially for charts with tight spacing or many bars.
You can use the manual method, but adjust the vertical alignment and color for visibility:
for bar in bars:
height = bar.get_height()
ax.text(bar.get_x() + bar.get_width()/2, height / 2,
f'{height/1e3:.0f}K', ha='center', va='center', color='white', fontsize=10)You can refer to the screenshot below to see the output.

This places the label in the middle of each bar with white text, which works well on darker bars.
Tips for Effective Bar Chart Labels
- Keep labels concise: Use units like K (thousands) or M (millions) to avoid clutter.
- Match label style to audience: For US business reports, currency formatting (e.g., $25,000) is often expected.
- Consider label position: Above bars for clarity, inside bars for style.
- Use color contrast: Make sure labels are readable against the bar color.
- Avoid overlapping: If bars are too close, consider rotating labels or using smaller font sizes.
Adding labels to your Matplotlib bar charts is a small step that makes a big difference in how your data is perceived. Whether you choose the built-in bar_label() method or prefer manual control with loops, these techniques will help you create polished, professional charts that speak clearly to your audience.
Try these methods with your US-specific datasets, like sales by state, demographic data, or survey results, and watch how much easier it becomes for viewers to understand your story at a glance.
You may read other Matplotlib articles:
- Matplotlib Set y Axis Range
- Module ‘matplotlib’ has no attribute ‘artist’
- Matplotlib Time Series Plot

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.