parent
d0e4d0b7c9
commit
b85c2c8609
@ -0,0 +1,140 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Awesome-pyecharts</title>
|
||||
<script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
|
||||
<script type="text/javascript" src="https://assets.pyecharts.org/assets/themes/infographic.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="cf9171b428624c54bc4aff53cf3f918d" class="chart-container" style="width:900px; height:500px;"></div>
|
||||
<script>
|
||||
var chart_cf9171b428624c54bc4aff53cf3f918d = echarts.init(
|
||||
document.getElementById('cf9171b428624c54bc4aff53cf3f918d'), 'infographic', {renderer: 'canvas'});
|
||||
var option_cf9171b428624c54bc4aff53cf3f918d = {
|
||||
"animation": true,
|
||||
"animationThreshold": 2000,
|
||||
"animationDuration": 1000,
|
||||
"animationEasing": "cubicOut",
|
||||
"animationDelay": 0,
|
||||
"animationDurationUpdate": 300,
|
||||
"animationEasingUpdate": "cubicOut",
|
||||
"animationDelayUpdate": 0,
|
||||
"series": [
|
||||
{
|
||||
"type": "pie",
|
||||
"name": "\u516c\u53f8\u7c7b\u578b\u73af\u5f62\u56fe",
|
||||
"clockwise": true,
|
||||
"data": [
|
||||
{
|
||||
"name": "\u4e0a\u5e02\u516c\u53f8",
|
||||
"value": 192
|
||||
},
|
||||
{
|
||||
"name": "\u4e8b\u4e1a\u5355\u4f4d",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"name": "\u5176\u5b83",
|
||||
"value": 71
|
||||
},
|
||||
{
|
||||
"name": "\u5408\u8d44",
|
||||
"value": 39
|
||||
},
|
||||
{
|
||||
"name": "\u56fd\u4f01",
|
||||
"value": 80
|
||||
},
|
||||
{
|
||||
"name": "\u5916\u5546\u72ec\u8d44",
|
||||
"value": 289
|
||||
},
|
||||
{
|
||||
"name": "\u6c11\u8425",
|
||||
"value": 714
|
||||
},
|
||||
{
|
||||
"name": "\u6e2f\u6fb3\u53f0\u516c\u53f8",
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"name": "\u80a1\u4efd\u5236\u4f01\u4e1a",
|
||||
"value": 132
|
||||
}
|
||||
],
|
||||
"radius": [
|
||||
"20%",
|
||||
"40%"
|
||||
],
|
||||
"center": [
|
||||
"50%",
|
||||
"40%"
|
||||
],
|
||||
"label": {
|
||||
"show": true,
|
||||
"position": "top",
|
||||
"margin": 8,
|
||||
"formatter": "{b}:{d}%"
|
||||
}
|
||||
}
|
||||
],
|
||||
"legend": [
|
||||
{
|
||||
"data": [
|
||||
"\u4e0a\u5e02\u516c\u53f8",
|
||||
"\u4e8b\u4e1a\u5355\u4f4d",
|
||||
"\u5176\u5b83",
|
||||
"\u5408\u8d44",
|
||||
"\u56fd\u4f01",
|
||||
"\u5916\u5546\u72ec\u8d44",
|
||||
"\u6c11\u8425",
|
||||
"\u6e2f\u6fb3\u53f0\u516c\u53f8",
|
||||
"\u80a1\u4efd\u5236\u4f01\u4e1a"
|
||||
],
|
||||
"selected": {},
|
||||
"show": true,
|
||||
"left": "15%",
|
||||
"top": "15%",
|
||||
"orient": "vertical",
|
||||
"padding": 5,
|
||||
"itemGap": 10,
|
||||
"itemWidth": 25,
|
||||
"itemHeight": 14
|
||||
}
|
||||
],
|
||||
"tooltip": {
|
||||
"show": true,
|
||||
"trigger": "item",
|
||||
"triggerOn": "mousemove|click",
|
||||
"axisPointer": {
|
||||
"type": "line"
|
||||
},
|
||||
"showContent": true,
|
||||
"alwaysShowContent": false,
|
||||
"showDelay": 0,
|
||||
"hideDelay": 100,
|
||||
"textStyle": {
|
||||
"fontSize": 14
|
||||
},
|
||||
"borderWidth": 0,
|
||||
"padding": 5
|
||||
},
|
||||
"title": [
|
||||
{
|
||||
"text": "\u516c\u53f8\u7c7b\u578b",
|
||||
"left": "35%",
|
||||
"top": "3%",
|
||||
"padding": 5,
|
||||
"itemGap": 10,
|
||||
"textStyle": {
|
||||
"fontSize": 25
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
chart_cf9171b428624c54bc4aff53cf3f918d.setOption(option_cf9171b428624c54bc4aff53cf3f918d);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,31 @@
|
||||
import pandas as pd
|
||||
from pyecharts.charts import Pie
|
||||
from pyecharts import options as opts
|
||||
from pyecharts.globals import ThemeType
|
||||
|
||||
data = [
|
||||
["上市公司", 192],
|
||||
["事业单位", 2],
|
||||
[ "其它", 71],
|
||||
[ "合资", 39],
|
||||
[ "国企", 80],
|
||||
[ "外商独资", 289],
|
||||
[ "民营", 714],
|
||||
[ "港澳台公司", 4],
|
||||
[ "股份制企业", 132]
|
||||
]
|
||||
|
||||
pie=Pie(init_opts=opts.InitOpts(theme=ThemeType.INFOGRAPHIC))\
|
||||
.add("公司类型环形图",
|
||||
data,
|
||||
radius=["20%","40%"],
|
||||
center=['50%','40%'],
|
||||
label_opts=opts.LabelOpts(formatter='{b}:{d}%')
|
||||
)\
|
||||
.set_global_opts(
|
||||
title_opts=opts.TitleOpts('公司类型',pos_left="35%",pos_top="3%",
|
||||
title_textstyle_opts=opts.TextStyleOpts(font_size=25)),
|
||||
legend_opts=opts.LegendOpts(orient="vertical",pos_left='15%',pos_top='15%')
|
||||
)
|
||||
|
||||
pie.render("公司类型环形图.html")
|
@ -0,0 +1,42 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
|
||||
# 解决中文乱码
|
||||
plt.rcParams['font.sans-serif'] = ['SimHei']
|
||||
# 创建画布
|
||||
plt.figure()
|
||||
|
||||
data=pd.read_csv("最新数据.csv")
|
||||
# 将城市这一列数据提取出来
|
||||
city = data[["城市",'职位名称']]
|
||||
# 将城市列去重后转化为列表变成x轴数据
|
||||
x_data = data['城市'].drop_duplicates().tolist()
|
||||
x_data=x_data[:10]
|
||||
# print(x_data)
|
||||
|
||||
# 将城市进行分组计数变为y轴数据
|
||||
y_data = city.groupby('城市').count().reset_index()
|
||||
y_data = y_data['职位名称'].tolist()
|
||||
y_data.sort(reverse=True)
|
||||
y_data=y_data[:10]
|
||||
|
||||
plt.bar(x_data, y_data,
|
||||
width=0.5,
|
||||
color='#9fe080',
|
||||
align="center",
|
||||
)
|
||||
|
||||
# 显示数据标签
|
||||
for a,b in zip(x_data,y_data):
|
||||
plt.text(
|
||||
a, #标签的x坐标
|
||||
b, #标签的y坐标
|
||||
b, #标签的内容
|
||||
ha='center',
|
||||
va='bottom',
|
||||
fontsize=10)
|
||||
|
||||
plt.title("就业机会前十的城市")
|
||||
plt.xlabel("城市")
|
||||
|
||||
plt.show()
|
Loading…
Reference in new issue