Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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

How to plot pie chart in python

import matplotlib.pyplot as plt
import seaborn as sns

#define data
data = [value1, value2, value3, ...]
labels = ['label1', 'label2', 'label3', ...]

#define Seaborn color palette to use
colors = sns.color_palette('pastel')[0:5]

#create pie chart
plt.pie(data, labels = labels, colors = colors, autopct='%.0f%%')
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: how to install numpy 
Python :: numpy documentation 
Python :: python create new pandas dataframe with specific columns 
Python :: Python Current time using datetime object 
Python :: pandas - from umeric to string 
Python :: clearing all text from a file in python 
Python :: discord.py add role on member join 
Python :: label encoder python 
Python :: array of 1 to 100 python 
Python :: sorting rows and columns in pandas 
Python :: python write to command prompt 
Python :: get a list of column names pandas 
Python :: numpy read image 
Python :: how to find the most frequent value in a column in pandas dataframe 
Python :: bee movie script 
Python :: python password generator 
Python :: install python 3.9 linux 
Python :: how to lowercase list in python 
Python :: convert seconds to hours python 
Python :: conda python 3.8 
Python :: exception get line number python 
Python :: selenium-screenshot python 
Python :: split a path into all subpaths 
Python :: python random randint except a number 
Python :: check cuda version pytorch 
Python :: beautifulsoup find by class 
Python :: python read csv 
Python :: sum of all nan values pandas 
Python :: python open new chrome tab 
Python :: filter with different operator in django 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =