Polar Chart

Music Genre Listening Patterns

Polar area chart showing music streaming patterns across different genres and time periods.

Output
Music Genre Listening Patterns
Python
import matplotlib.pyplot as plt
import numpy as np

# Music genres
genres = ['Pop', 'Hip-Hop', 'Rock', 'Electronic', 'R&B', 'Jazz', 'Classical', 'Country']
morning = [15, 10, 8, 5, 8, 12, 18, 6]
evening = [25, 30, 15, 22, 18, 8, 5, 10]

# Prepare angles
angles = np.linspace(0, 2 * np.pi, len(genres), endpoint=False).tolist()
morning_plot = morning + [morning[0]]
evening_plot = evening + [evening[0]]
angles += angles[:1]

# Light theme
fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(polar=True), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

# Morning listening
ax.fill(angles, morning_plot, color='#F5B027', alpha=0.4, label='Morning')
ax.plot(angles, morning_plot, color='#F5B027', linewidth=2)

# Evening listening
ax.fill(angles, evening_plot, color='#5314E6', alpha=0.4, label='Evening')
ax.plot(angles, evening_plot, color='#5314E6', linewidth=2)

# Styling
ax.set_ylim(0, 35)
ax.set_xticks(angles[:-1])
ax.set_xticklabels(genres, fontsize=11, color='#1f2937', fontweight='500')
ax.set_yticks([10, 20, 30])
ax.set_yticklabels(['10%', '20%', '30%'], fontsize=9, color='#6b7280')

ax.spines['polar'].set_color('#e5e7eb')
ax.grid(color='#e5e7eb', linewidth=0.8)
ax.tick_params(colors='#374151')

ax.set_title('Music Streaming by Time of Day', fontsize=16, color='#1f2937', fontweight='bold', pad=25)
ax.legend(loc='upper right', bbox_to_anchor=(1.15, 1.1), frameon=False)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support