Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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()
Comment

PREVIOUS NEXT
Code Example
Python :: model.predict([x_test]) error 
Python :: read binary file python 
Python :: pandas replace nan 
Python :: python sort 2d list 
Python :: pandas fill missing values with average 
Python :: random string generator python 
Python :: add column names to dataframe pandas 
Python :: values of unique from dataframe with count 
Python :: how to insert a variable into a string without breaking up the string in python 
Python :: get local python api image url 
Python :: how to get height in pyqt5 
Python :: python datetime last day of month 
Python :: python strftime utc offset 
Python :: pyaudio install error ubuntu 
Python :: import a txt file into python 
Python :: spacex 
Python :: sort array python by column 
Python :: python datetime to utc 
Python :: dataframe to dictionary with one column as key 
Python :: remove n from string python 
Python :: python: select specific columns in a data frame 
Python :: python open folder in explorer 
Python :: plt show 2 images 
Python :: python remove all except numbers 
Python :: pandas print full dataframe 
Python :: python split string regular expression 
Python :: create a new file in python 3 
Python :: Setting a conditional variable in python. Using an if else statement in python. 
Python :: python datetime without seconds 
Python :: how to make a kivy label multiline text 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =