All examples for Data Visualization Chart Recommender

Sparse Temporal Data Patterns

Demonstrates stem plot (lollipop chart) for visualizing sparse event data where most days have zero occurrences, with threshold highlighting and pattern analysis.

Input

What you provide to the skill

Visualize event occurrence patterns across days with very sparse data - most days have zero occurrences, few days have 15+ events

Output

What the skill generates for you

VISUALIZATION RECOMMENDATION
๐Ÿ“Š Your Data: Time series with 90 days, highly sparse (85.6% zeros), 13 days with events (5 low, 8 high)
๐ŸŽฏ Your Goal: Show event occurrence patterns with very sparse data
RECOMMENDED: Stem Plot (Lollipop Chart)
โœ… Why this works:
- Specifically designed for discrete events - each stem represents a single day
- Vertical lines from baseline make zero days visually clear (empty space = no events)
- Perfect for sparse data - doesn't clutter with connecting lines
- Highlights the occasional spikes (15+ events) dramatically
- Maintains temporal continuity while emphasizing discrete occurrences
- Zero baseline is explicit, making absence of data meaningful
โŒ NOT Recommended:
- Line chart: Implies continuity between points; connecting zeros looks misleading
- Bar chart: 90 bars would be cluttered; bars for zeros waste ink
- Scatter plot: Loses temporal connection; zeros at baseline hard to see
- Heatmap: Requires binning/grouping; loses daily granularity
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib.dates as mdates
from matplotlib.patches import Patch
# Generate sparse event data
np.random.seed(42)
dates = pd.date_range('2025-01-01', '2025-03-31', freq='D')
events = np.zeros(len(dates), dtype=int)
high_activity_indices = np.random.choice(len(dates), size=8, replace=False)
for idx in high_activity_indices:
events[idx] = np.random.randint(15, 35)
low_activity_indices = np.random.choice([i for i in range(len(dates)) if i not in high_activity_indices],
size=5, replace=False)
for idx in low_activity_indices:
events[idx] = np.random.randint(1, 6)
df = pd.DataFrame({'Date': dates, 'Events': events})
# Create stem plot
fig, ax = plt.subplots(figsize=(14, 6))
markerline, stemlines, baseline = ax.stem(df['Date'], df['Events'],
linefmt='#2E86AB',
markerfmt='o',
basefmt=' ')
markerline.set_markerfacecolor('#2E86AB')
markerline.set_markeredgecolor('#2E86AB')
markerline.set_markersize(6)
stemlines.set_linewidth(1.5)
# Highlight high activity days
for i, (date, count) in enumerate(zip(df['Date'], df['Events'])):
if count >= 15:
ax.plot(date, count, 'o', color='#E63946', markersize=8, zorder=3)
# Reference line at 15 events
ax.axhline(y=15, color='#E63946', linestyle='--', linewidth=1.5, alpha=0.4)
ax.set_xlabel('Date', fontsize=12, fontweight='bold')
ax.set_ylabel('Event Count', fontsize=12, fontweight='bold')
ax.set_title('Event Occurrence Patterns: January - March 2025\nHighly Sparse Data (85.6% Zero Days)',
fontsize=14, fontweight='bold', pad=20)
ax.grid(axis='y', alpha=0.3, linestyle='-', linewidth=0.5)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.xaxis.set_major_formatter(mdates.DateFormatter('%b %d'))
ax.xaxis.set_major_locator(mdates.WeekdayLocator(interval=2))
plt.xticks(rotation=45, ha='right')
legend_elements = [
Patch(facecolor='#2E86AB', label='Low Activity (< 15 events)'),
Patch(facecolor='#E63946', label='High Activity (15+ events)'),
plt.Line2D([0], [0], color='#E63946', linestyle='--', linewidth=1.5,
alpha=0.4, label='Threshold Line')
]
ax.legend(handles=legend_elements, loc='upper right', framealpha=0.9)
plt.tight_layout()
plt.savefig('sparse_event_pattern.png', dpi=300, bbox_inches='tight')
plt.show()

KEY INSIGHTS

SPARSITY PATTERN:

  • 77 of 90 days (85.6%) have ZERO events - extreme sparsity
  • Only 14.4% of days show any activity at all
  • Events are clustered: 8 high-activity bursts, 5 minor occurrences

EVENT DISTRIBUTION:

  • High activity days (15+ events): 8 days, ranging from 15 to 33 events
  • Low activity days (1-14 events): 5 days with 1-5 events each
  • Total events across 90 days: 204 events (mean: 2.27/day, heavily skewed)

TEMPORAL PATTERNS:

  • No clear weekly or monthly pattern visible
  • Events appear sporadic/random rather than cyclical
  • Long stretches of inactivity punctuated by sudden bursts
  • Suggests event-driven rather than scheduled occurrences

RECOMMENDATIONS FOR FURTHER ANALYSIS:

  1. Investigate what triggers the 15+ event days - external factors?
  2. Consider if events are truly random or if thereโ€™s a hidden pattern
  3. Calculate inter-event intervals to detect clustering patterns
  4. Consider a complementary cumulative event plot to show total events over time