Area Chart

Meditation Heart Rate

Heart rate variability during meditation session

Output
Meditation Heart Rate
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)
time = np.linspace(0, 20, 400)  # 20 min session

# Heart rate drops during meditation
baseline = 75
meditation_effect = -15 * (1 - np.exp(-time/5))
breathing_cycle = 3 * np.sin(2 * np.pi * time / 0.5)  # breath rhythm
hrv = np.random.normal(0, 2, len(time))
hr = baseline + meditation_effect + breathing_cycle * 0.3 + hrv

fig, ax = plt.subplots(figsize=(10, 5), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

ax.fill_between(time, 50, hr, alpha=0.4, color='#27F5B0')
ax.plot(time, hr, color='#27F5B0', linewidth=1.5)

# Start and end markers
ax.scatter([0], [hr[0]], color='#F5276C', s=100, zorder=5, edgecolors='white', linewidth=2)
ax.scatter([20], [hr[-1]], color='#6CF527', s=100, zorder=5, edgecolors='white', linewidth=2)

ax.text(0.5, hr[0] + 3, f'{hr[0]:.0f} BPM', color='#F5276C', fontsize=10, ha='center')
ax.text(19.5, hr[-1] + 3, f'{hr[-1]:.0f} BPM', color='#6CF527', fontsize=10, ha='center')

ax.set_xlabel('Minutes', color='#1f2937', fontsize=11)
ax.set_ylabel('Heart Rate (BPM)', color='#1f2937', fontsize=11)
ax.set_title('Heart Rate During Meditation', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#374151', labelsize=9)
for spine in ax.spines.values():
    spine.set_color('#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.set_xlim(0, 20)
ax.set_ylim(50, 85)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support