Create a pie chart in Matplotlib

Python

Matplotlib

Pie

Create

Luc B.

Python

Matplotlib

Pie Chart

While pie charts have their share of criticisms, they are widely used in the business world and thus deserve attention. Pie charts are useful for visualizing how a whole is decomposed into several parts.

Code Example

Use the plt.pie() function to create a pie chart in Matplotlib.

import matplotlib.pyplot as plt

labels = ['Python', 'MATLAB', 'R', 'Julia']
values = [60, 20, 32, 13]

# Create pie chart here
plt.pie(values, labels=labels)

plt.show()

png