Bar Chart

Rainbow Palette Bar

Multi-color bars with value labels.

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

COLORS = {
    'rainbow': ['#EF4444', '#F59E0B', '#10B981', '#3B82F6', '#8B5CF6', '#EC4899'],
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
    'grid': '#F1F5F9',
}

categories = ['Red', 'Orange', 'Green', 'Blue', 'Purple', 'Pink']
values = [78, 65, 82, 90, 55, 70]

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

for i, (v, c) in enumerate(zip(values, COLORS['rainbow'])):
    ax.bar(i, v, width=0.5, color=c, alpha=0.15, zorder=1)
    ax.bar(i, v, width=0.4, color=c, alpha=0.85, edgecolor='white', linewidth=2, zorder=3)
    ax.text(i, v + 3, str(v), ha='center', fontsize=10, fontweight='bold', color=COLORS['text'])

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)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support