Pie Chart

Pet Ownership Types

Dark theme exploded pie showing types of pet ownership

Output
Pet Ownership Types
Python
import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

pets = ['Dogs', 'Cats', 'Fish', 'Birds', 'Reptiles', 'Small Mammals']
owners = [40, 35, 10, 7, 5, 3]
colors = ['#f59e0b', '#fbbf24', '#fcd34d', '#fde68a', '#fef3c7', '#fffbeb']
explode = (0.05, 0.03, 0, 0, 0, 0)

wedges, texts, autotexts = ax.pie(owners, labels=pets, autopct='%1.0f%%',
                                   colors=colors, explode=explode, startangle=45,
                                   wedgeprops={'edgecolor': '#0a0a0f', 'linewidth': 2})

for text in texts:
    text.set_color('white')
    text.set_fontsize(10)
for autotext in autotexts:
    autotext.set_color('#0a0a0f')
    autotext.set_fontweight('bold')

ax.set_title('Pet Ownership Distribution', fontsize=16, fontweight='bold', color='white', pad=20)
plt.tight_layout()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support