Answers for "seaborn pie chart dataframe"

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
0

How to Create a Pie Chart in Seaborn

Pie chart in Seaborn
import matplotlib.pyplot as plt
import seaborn as sns

# car sales data
total_sales = [3000, 2245, 1235, 5330, 4200]
explode = [0, 0, 0, 0.2, 0]

location = ['Bangalore', 'Delhi', 'Chennai', 'Mumbai', 'Kolkatta']

# Seaborn color palette to plot pie chart
colors = sns.color_palette('bright')

# create pie chart using matplotlib
plt.pie(total_sales, labels=location, colors=colors,
        autopct='%.0f%%', explode=explode, shadow=True, rotatelabels='true')
plt.show()
Posted by: Guest on January-29-2022

Python Answers by Framework

Browse Popular Code Answers by Language