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 :: django change user password 
Python :: 2 for loops at the same time in Python 
Python :: no such table: django_session admin 
Python :: how to plot corilation python 
Python :: convert string to class name python 
Python :: rename key in dict python 
Python :: converting jupyter notebook files to python 
Python :: python append to csv on new line 
Python :: python check if string has space 
Python :: python sqlite insert 
Python :: import django-on-heroku 
Python :: python list .remove() in for loop breaks 
Python :: check python version kali linux 
Python :: how to check python version on terminal 
Python :: python yaml to dict 
Python :: erase % sign in row pandas 
Python :: python run shell command 
Python :: spacy nlp load 
Python :: python get list of files in directory 
Python :: measure execution time in jupyter notebook 
Python :: python gui using css 
Python :: download images python google 
Python :: dunder pyhton 
Python :: python get pid of process 
Python :: how to print time python 
Python :: iterate through attributes of class python 
Python :: extend a class python 
Python :: python aws s3 client 
Python :: console.log() python 
Python :: linking custom CSS in flask 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =