Answers for "matplotlib pie chart with pandas"

4

python pie chart

import matplotlib.pyplot as plt
labels = ['Python', 'C++', 'Ruby', 'Java']
sizes = [215, 130, 245, 210]
# Plot
plt.pie(sizes, labels=labels, 
        autopct='%1.1f%%', shadow=True, startangle=140)
plt.axis('equal')
plt.show()
Posted by: Guest on November-19-2020
0

pie chart python pandas

df = pd.DataFrame({'mass': [0.330, 4.87 , 5.97],
                   'radius': [2439.7, 6051.8, 6378.1]},
                    index = ['Mercury', 'Venus', 'Earth'])

plot = df.plot.pie(y='mass', figsize=(5, 5))
Posted by: Guest on July-15-2021

Python Answers by Framework

Browse Popular Code Answers by Language