Stream Graph

Food Delivery Orders Stream

Stream graph showing food delivery order patterns by cuisine type throughout the day.

Output
Food Delivery Orders Stream
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'layers': ['#EF4444', '#F59E0B', '#10B981', '#3B82F6', '#8B5CF6'],
    'background': '#ffffff',
    'text': '#1f2937',
    'grid': '#e5e7eb',
}

np.random.seed(909)
hours = np.arange(0, 24)

# Cuisine types by hour
pizza = 10 + 25 * np.exp(-((hours - 19)**2) / 8) + 15 * np.exp(-((hours - 12)**2) / 10) + np.random.normal(0, 2, 24)
asian = 8 + 20 * np.exp(-((hours - 19)**2) / 10) + 10 * np.exp(-((hours - 13)**2) / 8) + np.random.normal(0, 2, 24)
mexican = 5 + 15 * np.exp(-((hours - 20)**2) / 8) + np.random.normal(0, 2, 24)
burgers = 8 + 18 * np.exp(-((hours - 13)**2) / 6) + 12 * np.exp(-((hours - 19)**2) / 8) + np.random.normal(0, 2, 24)
healthy = 3 + 12 * np.exp(-((hours - 12)**2) / 8) + np.random.normal(0, 1, 24)

data = [np.clip(d, 1, None) for d in [pizza, asian, mexican, burgers, healthy]]

fig, ax = plt.subplots(figsize=(14, 6), facecolor=COLORS['background'])
ax.set_facecolor(COLORS['background'])

ax.stackplot(hours, *data, colors=COLORS['layers'], alpha=0.85, baseline='sym',
             labels=['Pizza', 'Asian', 'Mexican', 'Burgers', 'Healthy'])

ax.axhline(0, color=COLORS['grid'], linewidth=0.5)
ax.set_xlim(0, 23)
ax.set_xticks([0, 6, 12, 18, 24])
ax.set_xticklabels(['12 AM', '6 AM', '12 PM', '6 PM', '12 AM'])

ax.set_title('Food Delivery Orders by Cuisine', color=COLORS['text'], fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Hour of Day', color=COLORS['text'], fontsize=11)
ax.set_ylabel('Orders', color=COLORS['text'], fontsize=11)

ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12), frameon=False, fontsize=9, ncol=5)

for spine in ax.spines.values():
    spine.set_color(COLORS['grid'])
ax.tick_params(colors=COLORS['text'], labelsize=9)

plt.tight_layout()
plt.subplots_adjust(bottom=0.18)
plt.show()
Library

Matplotlib

Category

Time Series

Did this help you?

Support PyLucid to keep it free & growing

Support