└── app.py /app.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | 3 | # Sample data 4 | labels = ['Category A', 'Category B', 'Category C', 'Category D'] 5 | sizes = [25, 35, 20, 20] # Percentages 6 | colors = ['blue', 'green', 'red', 'purple'] 7 | 8 | # Plotting the pie chart 9 | plt.figure(figsize=(7, 7)) 10 | plt.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', startangle=140, shadow=True) 11 | 12 | # Formatting the plot 13 | plt.title('Pie Chart Example') 14 | plt.axis('equal') # Equal aspect ratio ensures the pie chart is circular 15 | 16 | # Show the plot 17 | plt.show() 18 | --------------------------------------------------------------------------------