Bar Chart

Monthly Sales Bar

Simple monthly bar chart with glow effect.

Output
Monthly Sales Bar
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'primary': '#6366F1',
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
    'grid': '#F1F5F9',
}

months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
values = [42, 58, 35, 67, 49, 72]
x = np.arange(len(months))

fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])

# Bars with glow
for i, v in enumerate(values):
    ax.bar(i, v, width=0.55, color=COLORS['primary'], alpha=0.15, zorder=1)
    ax.bar(i, v, width=0.45, color=COLORS['primary'], alpha=0.85,
           edgecolor='white', linewidth=2, zorder=3)

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color(COLORS['grid'])
ax.spines['bottom'].set_color(COLORS['grid'])

ax.yaxis.grid(True, color=COLORS['grid'], linewidth=1, zorder=0)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)

ax.set_xticks(x)
ax.set_xticklabels(months)
ax.set_ylim(0, 90)
ax.set_ylabel('Sales ($K)', fontsize=10, color=COLORS['text'], labelpad=10)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support