Python数据分析与可视化pyecharts数据可视化(实训六)

Posted ZSYL

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python数据分析与可视化pyecharts数据可视化(实训六)相关的知识,希望对你有一定的参考价值。

pyecharts数据可视化(实训六)

示例代码

from pyecharts import options as opts
from pyecharts.globals import ThemeType
import numpy as np
%matplotlib inline
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()

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()

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()


加油!

感谢!

努力!

以上是关于Python数据分析与可视化pyecharts数据可视化(实训六)的主要内容,如果未能解决你的问题,请参考以下文章

基于Python的数据可视化库pyecharts介绍

Python数据可视化神器——pyecharts的超详细使用指南!

python数据可视化案例——平行坐标系(使用pyecharts或pandas)

python可视化神器——pyecharts库

学习笔记python - pyecharts

pyecharts库的主要作用