Bar Chart

Gradient Palette Bar

Bars with gradient color palette and glow effect.

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

# === STYLE CONFIG ===
COLORS = {
    'bars': ['#6366F1', '#8B5CF6', '#A855F7', '#C084FC', '#D8B4FE'],
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
    'grid': '#F1F5F9',
}

# === DATA ===
categories = ['A', 'B', 'C', 'D', 'E']
values = [85, 72, 65, 58, 45]

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

# === PLOT ===
for i, (cat, val, color) in enumerate(zip(categories, values, COLORS['bars'])):
    # Glow
    ax.bar(i, val, width=0.6, color=color, alpha=0.2, zorder=1)
    # Main bar
    ax.bar(i, val, width=0.5, color=color, alpha=0.9, 
           edgecolor='white', linewidth=2, zorder=3)
    # Value - with proper spacing above
    ax.text(i, val + 4, f'{val}', ha='center', fontsize=11, 
            fontweight='bold', color=COLORS['text'])

# === 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=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(range(len(categories)))
ax.set_xticklabels(categories)
ax.set_ylim(0, 110)  # Room for labels

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support