from matplotlib import pyplot as plt
from matplotlib import cm
import numpy as np
slices = [59219, 55466, 47544, 36443, 35917, 31991, 27097, 23030, 20524, 18523, 18017, 7920, 7331, 7201, 5833]
labels = ['JavaScript', 'HTML/CSS', 'SQL', 'Python', 'Java', 'Bash/Shell/PowerShell', 'C#', 'PHP', 'C++', 'TypeScript', 'C', 'Other(s):', 'Ruby', 'Go', 'Assembly']
cs=cm.Set1(np.arange(len(slices))/float(len(slices)))
print cs
explode =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0.1, 0.1, 0.1, 0.1]
plt.pie(slices, labels=labels, colors=cs, explode=explode, autopct='%1.1f%%', wedgeprops={'edgecolor': 'black'})
#draw circle
centre_circle = plt.Circle((0,0),0.750,fc='white')
fig = plt.gcf()
fig.gca().add_artist(centre_circle)
plt.title('Programming Languages Programmers Use')
plt.show()
[[ 0.89411765 0.10196079 0.10980392 1. ]
[ 0.53228759 0.31111111 0.43607844 1. ]
[ 0.22143791 0.50692811 0.69281047 1. ]
[ 0.26745099 0.60941178 0.46274511 1. ]
[ 0.34117648 0.63555557 0.33673204 1. ]
[ 0.49803924 0.43267975 0.52287584 1. ]
[ 0.67686276 0.34431373 0.51137257 1. ]
[ 0.89228759 0.44679739 0.17045752 1. ]
[ 1. 0.63189542 0.05333333 1. ]
[ 1. 0.89960784 0.16 1. ]
[ 0.88366014 0.77908497 0.18562092 1. ]
[ 0.69751636 0.42562092 0.16261438 1. ]
[ 0.77803923 0.4047059 0.3937255 1. ]
[ 0.94745098 0.49464055 0.7095425 1. ]
[ 0.79660132 0.54980395 0.67947714 1. ]]
reference:
https://www.youtube.com/watch?v=MPiz50TsyF0&list=PL-osiE80TeTvipOqomVEeZ1HRrcEvtZB_&index=3
https://stackoverflow.com/questions/21034830/how-can-i-generate-more-colors-on-pie-chart-matplotlib
https://medium.com/@kvnamipara/a-better-visualisation-of-pie-charts-by-matplotlib-935b7667d77f
No comments:
Post a Comment