Creating Pie Chart using pyplot of Python Matplotlib Module

Creating Pie Chart using pyplot of Python Matplotlib Module

Instructor-svgAl-Mamun Sarkar
Apr 02 , 2020

Creating Pie Chart using pyplot of Python Matplotlib Module. The following codes shows how to create 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']

 

Create Pie Chart:

plt.pie(slices_data, labels=all_activities)
plt.title("Welcome to pie chart tutorial")
plt.xlabel('X-Axis')
plt.ylabel('Y-Axis')
plt.legend()
plt.show()

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram