Area Chart
Sentiment Timeline
Positive vs negative sentiment over time.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Data - Sentiment over time
np.random.seed(42)
days = np.arange(30)
positive = 55 + 15*np.sin(days/5) + np.random.normal(0, 5, 30)
negative = 45 - 15*np.sin(days/5) + np.random.normal(0, 5, 30)
positive = np.clip(positive, 0, 100)
negative = np.clip(negative, 0, 100)
# Figure - DARK THEME
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
# Positive/negative sentiment areas
ax.fill_between(days, 50, positive, where=(positive >= 50), alpha=0.5, color='#27F5B0', label='Positive')
ax.fill_between(days, negative, 50, where=(negative < 50), alpha=0.5, color='#F5276C', label='Negative')
ax.plot(days, positive, color='#27F5B0', linewidth=2)
ax.plot(days, negative, color='#F5276C', linewidth=2)
ax.axhline(50, color='#888888', linewidth=1, linestyle='--', alpha=0.5)
# Styling
ax.set_xlabel('Day', color='white', fontsize=11)
ax.set_ylabel('Sentiment Score', color='white', fontsize=11)
ax.set_title('Social Media Sentiment Analysis', color='white', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#888888', labelsize=9)
for spine in ax.spines.values():
spine.set_color('#333333')
ax.yaxis.grid(True, color='#1a1a2e', linewidth=0.5)
ax.set_xlim(0, 29)
ax.set_ylim(0, 100)
ax.legend(facecolor='#0a0a0f', edgecolor='#333333', labelcolor='white')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕