Stream Graph

Telemedicine Visits by Specialty Stream

Stream visualization of telemedicine appointment distribution by medical specialty.

Output
Telemedicine Visits by Specialty Stream
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'background': '#0a0a0f',
    'text': '#ffffff',
    'grid': '#333333',
}

np.random.seed(3535)
months = np.arange(0, 36)

primary_care = 35 + 1.2 * months + 5 * np.sin(months * np.pi / 6) + np.random.normal(0, 2, 36)
mental_health = 20 + 1.5 * months + np.random.normal(0, 2, 36)
dermatology = 15 + 0.5 * months + np.random.normal(0, 1, 36)
urgent_care = 18 + 0.8 * months + 8 * ((months > 20) & (months < 28)) + np.random.normal(0, 2, 36)
specialist = 12 + 0.4 * months + np.random.normal(0, 1, 36)

data = [np.clip(d, 1, None) for d in [primary_care, mental_health, dermatology, urgent_care, specialist]]
colors = ['#27D3F5', '#F5276C', '#F5B027', '#6CF527', '#4927F5']

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

ax.stackplot(months, *data, colors=colors, alpha=0.85, baseline='sym',
             labels=['Primary Care', 'Mental Health', 'Dermatology', 'Urgent Care', 'Specialists'])

ax.axhline(0, color=COLORS['grid'], linewidth=0.5, alpha=0.5)
ax.set_xlim(0, 35)

ax.set_title('Telemedicine Visits by Specialty', color=COLORS['text'], fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Month', color=COLORS['text'], fontsize=11)
ax.set_ylabel('Visits (thousands)', color=COLORS['text'], fontsize=11)

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

for spine in ax.spines.values():
    spine.set_visible(False)
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