需要源码请点赞关注收藏后评论区留言私信~~~
下面针对一些App的下载量数据,使用pyecharts进行可视化分析,各类App某段时间的下载次数如下
App 下载次数
相机 5045137
短视频 4608092
视频 35723063
浏览器 23775808
商城 15367847
购票 10424808
小说 76975429
聊天 7393185
小工具 64636392
理财记账 50491990
1:绘制数据的柱状图
代码如下
from pyecharts.charts import Bar # x轴数据 items = ["相机", "短视频", "视频", "浏览器", "商城", "购票", "小说", "聊天", "小工具", "理财记账"] # y轴数据 sum_app = [[5045137.0], [4608092.0], [35723063.0], [23775808.0], [15367847.0], [10424808.0], [76975429.0], [7393185.0], [64636392.0], [50491990.0]] # 生成实例化对象 bar = Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT)) bar.add_xaxis([ "总数"]) for item in items: bar.add_yaxis(item,sum_app[items.index(item)]) bar.set_global_opts(title_opts=opts.TitleOpts(title="APP类型", subtitle="APP类型")) # bar.render("APP类型.html") bar.render_notebook()
2:绘制各类App下载量的饼图
代码如下
from pyecharts.charts import Pie items = ["相机", "短视频", "视频", "浏览器", "商城", "购票", "小说", "聊天", "小工具", "理财记账"] # y轴数据 sum_app = [[5045137.0], [4608092.0], [35723063.0], [23775808.0], [15367847.0], [10424808.0], [76975429.0], [7393185.0], [64636392.0], [50491990.0]] # 生成实例化对象 pie = Pie(init_opts=opts.InitOpts(theme=ThemeType.INFOGRAPHIC)) pie.add( "",data_pair = [(item,sum_app[items.index(item)]) for item in items], radius=["30%", "75%"], center=["50%", "50%"], rosetype="radius", label_opts=opts.LabelOpts(is_show=False)) pie.set_global_opts(title_opts = opts.TitleOpts(title="APP比例")) pie.set_series_opts(label_opts = opts.LabelOpts(formatter="{b}: {c}")) pie.render_notebook()
3:绘制各类App下载量的涟漪特效散点图
代码如下
from pyecharts import options as opts from pyecharts.charts import EffectScatter from pyecharts.globals import SymbolType c = ( EffectScatter() .add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) .add_yaxis('商家A', [114, 55, 27, 101, 125, 27, 105]) # .add_yaxis('商家B',[57, 134, 137, 129, 145, 60, 49]) .set_global_opts(title_opts=opts.TitleOpts(title="EffectScatter-基本示例")) ) c.render_notebook()
创作不易 觉得有帮助请点赞关注收藏~~~