Matplotlib is library which is used in data visualization.

Code for Creating Pie Chart using matplotlib:

For creating pie chart import matplotlib as shown below

import matplotlib.pyplot as plt fig = plt.figure(figsize =(100, 7)) mylabels=['x','y','z'] values=[159,147,89] # autopct is used for reflecting percentage plt.pie(values,labels=mylabels,autopct=lambda x: '{:.2f}%({:.0f})'.format(x,(x/100)*sum(values))) plt.show()

Output will be pie chart shown below

Pie chart using matplotlib
1.Plot Pie chart in Matplotlib

labels and values can be mapped from pandas dataframe.

By SC

Leave a Reply

Your email address will not be published. Required fields are marked *