数据可视化

#!/usr/bin/env python3
#-*- coding:utf-8 -*-
'''
Administrator 
2018/11/1 
'''
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号
plt.figure(facecolor='#10426e',edgecolor='#ffffff')
font={"color":"white"}


slices = [361,527,359,123,12,]
activities = ['30-30岁以下(361人)','31-40岁(527人)','41-50岁(359人)','51-60岁(123人)','60岁以上(12人)',]
cols = ['#ff7f50','#87cefa','#da70d6','#32cd32','#6495ed',]

plt.pie(slices,
        labels=activities,
        colors=cols,
        startangle=0,
        #shadow= True,
        explode=(0,0,0,0,0),
        textprops={ 'color': 'w'},
        autopct='%1.2f%%')

plt.title('人员年龄占比',fontdict=font)
plt.axis('equal')
plt.legend(loc='upper left')
plt.show()
人员年龄结构占比

 

posted @ 2018-11-01 14:39  巨兽~墨菲特  阅读(78)  评论(0编辑  收藏  举报