""" author:少校 create Time:2025/2/28 11:15 越努力越幸运 """ from pyecharts.charts import Bar, Pie from pyecharts import options from pyecharts.globals import ThemeType # 1.创建图表,添加主题效果 bar = Bar( init_opts=options.InitOpts( theme=ThemeType.PURPLE_PASSION # DARK、LIGHT、WHITE(默认)、CHALK、ESSOS、ROMANTIC、HALLOWEEN ) ) # 2.添加数据 bar.add_xaxis(['数据分析', '物联网', '云计算', '鸿蒙开发', '网络安全']) bar.add_yaxis('招生人数', [345, 403, 270, 185, 300]) bar.add_yaxis('应届生人数', [250, 120, 50, 80, 180]) bar.set_global_opts( title_opts=options.TitleOpts( title='XXX培训机构各学科招生情况', subtitle='总人数与应届人数', text_align='center', pos_left='430' ), legend_opts=options.LegendOpts( pos_right=80, pos_top=30 ) ) # 3. 制图 bar.render('charts/07主题.html') print('------------------------------------华--丽--的--分--割--线------------------------------------') pie = Pie( init_opts=options.InitOpts( theme=ThemeType.ESSOS ) ) pie.add( '销售', [('华为', 290000), ('小米', 329870), ('Apple', 128700), ('Vivo', 98760), ('Oppo', 109870)] ) pie.render('charts/主题2.html')
08.主题定制
本节1321字2025-03-03 17:20:49