Pie Chart

Customer Segments

Customer segmentation donut chart for retail analysis

Output
Customer Segments
Python
import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots(figsize=(10, 8), facecolor='#fef7ff')

sizes = [35, 28, 22, 15]
labels = ['Premium', 'Regular', 'Occasional', 'New']
colors = ['#c026d3', '#e879f9', '#f0abfc', '#fae8ff']

wedges, texts, autotexts = ax.pie(sizes, labels=None, colors=colors,
                                   autopct='%1.0f%%', startangle=45,
                                   wedgeprops={'linewidth': 3, 'edgecolor': 'white', 'width': 0.6},
                                   pctdistance=0.75)

for autotext in autotexts:
    autotext.set_color('#581c87')
    autotext.set_fontsize(12)
    autotext.set_fontweight('bold')

centre_circle = plt.Circle((0, 0), 0.40, fc='#fef7ff')
ax.add_patch(centre_circle)
ax.text(0, 0, '10K\nUsers', ha='center', va='center', color='#7e22ce', fontsize=12, fontweight='bold')

ax.legend(wedges, labels, loc='center left', bbox_to_anchor=(1, 0.5),
          frameon=False, fontsize=11)

ax.set_title('Customer Segments', color='#581c87', fontsize=14, fontweight='bold', pad=20)
plt.tight_layout()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support