Python ProgrammingPython Programming

How to set border for wedges in Matplotlib pie chart?

Pie chart enable border for wedges:

import matplotlib.pyplot as plt

labels = ['India', 'Canada', 'Japan', 'Australia', 'Russia']
sizes = [31, 19, 15, 14, 21]  # Add upto 100%

# Plot the pie chart
plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=90,
        wedgeprops={"edgecolor":"0",'linewidth': 1,
                    'linestyle': 'dashed', 'antialiased': True})

# Equal aspect ratio ensures that pie is drawn as a circle.

# Display the graph onto the screen

The following is the output that will be obtained:

Pie chart enable border for wedges