Exploding Pie Chart using pyplot of python mathplotlib module

Author: Al-mamun Sarkar Date: 2020-04-02 17:45:28

Exploding Pie Chart using pyplot of python mathplotlib module. The following codes shows how to explode Pie Chart using python mathplotlib module.

 

Import Module:

import matplotlib.pyplot as plt

 

Create Data:

slices_data = [70,20,20,130]
all_activities = ['sleeping','eating','working','playing']

 

Creating and exploding pie chart:

plt.pie(slices_data, 
        labels=all_activities, 
        colors=colors,
       startangle=90,
       shadow = True,
       explode=(0, 0.2, 0, 0))
plt.title("Welcome to pie chart tutorial")
plt.xlabel('X-Axis')
plt.ylabel('Y-Axis')
plt.legend()
plt.show()