Bar Chart
Stacked Bars Light
Stacked horizontal bars with light theme
Output
Python
import matplotlib.pyplot as plt
import numpy as np
regions = ['North', 'South', 'East', 'West', 'Central']
online = [45, 38, 52, 35, 42]
retail = [32, 35, 28, 40, 33]
wholesale = [23, 27, 20, 25, 25]
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
y_pos = np.arange(len(regions))
ax.barh(y_pos, online, height=0.6, label='Online', color='#6366f1')
ax.barh(y_pos, retail, height=0.6, left=online, label='Retail', color='#22c55e')
ax.barh(y_pos, wholesale, height=0.6, left=np.array(online)+np.array(retail), label='Wholesale', color='#f59e0b')
ax.set_yticks(y_pos)
ax.set_yticklabels(regions, color='#374151', fontsize=10)
ax.set_xlabel('Revenue Share (%)', color='#6b7280', fontsize=11)
ax.set_xlim(0, 100)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#e5e7eb')
ax.spines['bottom'].set_color('#e5e7eb')
ax.tick_params(axis='both', colors='#6b7280', labelsize=9)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12), ncol=3, frameon=False, labelcolor='#374151', fontsize=9)
ax.set_title('Revenue by Channel', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Bar Chart examples
☕