#4. Pie Chart #Pie charts are used to show proportions of a whole. # Example: Pie chart of Profit distribution by Region profit_by_region = [7000, 11000, 7000, 8000] regions = ["North", "East", "West", "South"] plt.pie(profit_by_region, labels=regions, autopct='%1.1f%%', colors=['gold', 'lightblue', 'lightgreen', 'pink']) plt.title("Profit Distribution by Region") plt.show()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter