You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
912 B
31 lines
912 B
6 months ago
|
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")
|