Bar Chart

Modern Gradient Bar Chart

A sleek bar chart with gradient colors and clean styling

Output
Modern Gradient Bar Chart
Python
import matplotlib.pyplot as plt
import numpy as np

# === STYLE CONFIG ===
COLORS = {
    'bar': '#6366F1',
    'background': '#FAFBFC',
    'text': '#1E293B',
    'text_muted': '#64748B',
    'grid': '#E2E8F0',
}

# === DATA ===
categories = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
values = [45, 62, 78, 85, 72, 58, 40]
x = np.arange(len(categories))

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

# === PLOT ===
bars = ax.bar(x, values, color=COLORS['bar'], width=0.6, 
              edgecolor='white', linewidth=1)

# Gradient effect with alpha
for bar, val in zip(bars, values):
    bar.set_alpha(0.4 + 0.6 * val / max(values))

# Value labels
for i, v in enumerate(values):
    ax.text(i, v + 2, str(v), ha='center', fontsize=10, 
            color=COLORS['text'], fontweight='500')

# === AXES ===
ax.set_xlim(-0.5, len(categories) - 0.5)
ax.set_ylim(0, 100)
ax.set_xticks(x)
ax.set_xticklabels(categories)
ax.set_ylabel('Value', fontsize=10, color=COLORS['text_muted'], labelpad=10)

# === STYLING ===
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=0.5)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support