pywebio 和 pyecharts天生一对

import pywebio
from pyecharts import options as opts
from pyecharts.charts import WordCloud

words = [
    ("花鸟市场", 1446),
    ("汽车", 928),
    ("视频", 906),
    ("电视", 825),
    ("Lover Boy 88", 514),
    ("动漫", 486),
    ("音乐", 53),
    ("直播", 163),
    ("广播电台", 86),
    ("戏曲曲艺", 17),
    ("演出票务", 6),
    ("给陌生的你听", 1),
    ("资讯", 1437),
    ("商业财经", 422),
    ("娱乐八卦", 353),
    ("军事", 331),
    ("科技资讯", 313),
    ("社会时政", 307),
    ("时尚", 43),
    ("网络奇闻", 15),
    ("旅游出行", 438),
    ("景点类型", 957),
    ("国内游", 927),
    ("远途出行方式", 908),
    ("酒店", 693),
    ("关注景点", 611),
    ("旅游网站偏好", 512),
    ("出国游", 382),
    ("交通票务", 312),
    ("旅游方式", 187),
    ("旅游主题", 163),
    ("港澳台", 104),
    ("本地周边游", 3),
    ("小卖家", 1331),
    ("全日制学校", 941),
    ("基础教育科目", 585),
    ("考试培训", 473),
    ("语言学习", 358),
    ("留学", 246),
    ("K12课程培训", 207),
    ("艺术培训", 194),
    ("技能培训", 104),
    ("IT培训", 87),
    ("高等教育专业", 63),
    ("家教", 48),
    ("体育培训", 23),
    ("职场培训", 5),
    ("金融财经", 1328),
    ("银行", 765),
    ("股票", 452),
    ("保险", 415),
    ("贷款", 253),
    ("基金", 211),
    ("信用卡", 180),
    ("外汇", 138),
    ("P2P", 116),
    ("贵金属", 98),
    ("债券", 93),
    ("网络理财", 92),
    ("信托", 90),
    ("征信", 76),
    ("期货", 76),
    ("公积金", 40),
    ("银行理财", 36),
    ("银行业务", 30),
    ("典当", 7),
    ("海外置业", 1),
    ("汽车", 1309),
    ("汽车档次", 965),
    ("汽车品牌", 900),
    ("汽车车型", 727),
    ("购车阶段", 461),
    ("二手车", 309),
    ("汽车美容", 260),
    ("新能源汽车", 173),
    ("汽车维修", 155),
    ("租车服务", 136),
    ("车展", 121),
    ("违章查询", 76),
    ("汽车改装", 62),
    ("汽车用品", 37),
    ("路况查询", 32),
    ("汽车保险", 28),
    ("陪驾代驾", 4),
    ("网络购物", 1275),
    ("做我的猫", 1088),
    ("只想要你知道", 907),
    ("团购", 837),
    ("比价", 201),
    ("海淘", 195),
    ("移动APP购物", 179),
    ("支付方式", 119),
    ("代购", 43),
    ("体育健身", 1234),
    ("体育赛事项目", 802),
    ("运动项目", 405),
    ("体育类赛事", 337),
    ("健身项目", 199),
    ("健身房健身", 78),
    ("运动健身", 77),
    ("家庭健身", 36),
    ("健身器械", 29),
    ("办公室健身", 3),
    ("商务服务", 1201),
    ("法律咨询", 508),
    ("化工材料", 147),
    ("广告服务", 125),
    ("会计审计", 115),
    ("人员招聘", 101),
    ("印刷打印", 66),
    ("知识产权", 32),
    ("翻译", 22),
    ("安全安保", 9),
    ("公关服务", 8),
    ("商旅服务", 2),
    ("展会服务", 2),
    ("特许经营", 1),
    ("休闲爱好", 1169),
    ("收藏", 412),
    ("摄影", 393),
    ("温泉", 230),
    ("博彩彩票", 211),
    ("美术", 207),
    ("书法", 139),
    ("DIY手工", 75),
    ("舞蹈", 23),
    ("钓鱼", 21),
    ("棋牌桌游", 17),
    ("KTV", 6),
    ("密室", 5),
    ("采摘", 4),
    ("电玩", 1),
    ("真人CS", 1),
    ("轰趴", 1),
    ("家电数码", 1111),
    ("手机", 885),
    ("电脑", 543),
    ("大家电", 321),
    ("家电关注品牌", 253),
    ("网络设备", 162),
    ("摄影器材", 149),
    ("影音设备", 133),
    ("办公数码设备", 113),
    ("生活电器", 67),
    ("厨房电器", 54),
    ("智能设备", 45),
    ("个人护理电器", 22),
    ("服饰鞋包", 1047),
    ("服装", 566),
    ("饰品", 289),
    ("鞋", 184),
    ("箱包", 168),
    ("奢侈品", 137),
    ("母婴亲子", 1041),
    ("孕婴保健", 505),
    ("母婴社区", 299),
    ("早教", 103),
    ("奶粉辅食", 66),
    ("童车童床", 41),
    ("关注品牌", 271),
    ("宝宝玩乐", 30),
    ("母婴护理服务", 25),
    ("纸尿裤湿巾", 16),
    ("妈妈用品", 15),
    ("宝宝起名", 12),
    ("童装童鞋", 9),
    ("胎教", 8),
    ("宝宝安全", 1),
    ("宝宝洗护用品", 1),
    ("软件应用", 1018),
    ("系统工具", 896),
    ("理财购物", 440),
    ("生活实用", 365),
    ("影音图像", 256),
    ("社交通讯", 214),
    ("手机美化", 39),
    ("办公学习", 28),
    ("应用市场", 23),
    ("母婴育儿", 14),
    ("游戏", 946),
    ("手机游戏", 565),
    ("PC游戏", 353),
    ("网页游戏", 254),
    ("游戏机", 188),
    ("模拟辅助", 166),
    ("个护美容", 942),
    ("护肤品", 177),
    ("彩妆", 133),
    ("美发", 80),
    ("香水", 50),
    ("个人护理", 46),
    ("美甲", 26),
    ("SPA美体", 21),
    ("花鸟萌宠", 914),
    ("绿植花卉", 311),
    ("狗", 257),
    ("其他宠物", 131),
    ("水族", 125),
    ("猫", 122),
    ("动物", 81),
    ("鸟", 67),
    ("宠物用品", 41),
    ("宠物服务", 26),
    ("书籍阅读", 913),
    ("网络小说", 483),
    ("关注书籍", 128),
    ("文学", 105),
    ("报刊杂志", 77),
    ("人文社科", 22),
    ("建材家居", 907),
    ("装修建材", 644),
    ("家具", 273),
    ("家居风格", 187),
    ("家居家装关注品牌", 140),
    ("家纺", 107),
    ("厨具", 47),
    ("灯具", 43),
    ("家居饰品", 29),
    ("家居日常用品", 10),
    ("生活服务", 883),
    ("物流配送", 536),
    ("家政服务", 108),
    ("摄影服务", 49),
    ("搬家服务", 38),
    ("物业维修", 37),
    ("婚庆服务", 24),
    ("二手回收", 24),
    ("鲜花配送", 3),
    ("维修服务", 3),
    ("殡葬服务", 1),
    ("求职创业", 874),
    ("创业", 363),
    ("目标职位", 162),
    ("目标行业", 50),
    ("兼职", 21),
    ("期望年薪", 20),
    ("实习", 16),
    ("雇主类型", 10),
    ("星座运势", 789),
    ("星座", 316),
    ("算命", 303),
    ("解梦", 196),
    ("风水", 93),
    ("面相分析", 47),
    ("手相", 32),
    ("公益", 90),
]
import base64
with open("aaa.png","rb") as f:
    data=f.read()
    base64_data_str = str(base64.b64encode(data), encoding="utf-8")


c = (
    WordCloud()
    .add("", words, word_size_range=[12, 55])
    .set_global_opts(title_opts=opts.TitleOpts(title="WordCloud-自定义图片"))
)
from pywebio import start_server
from pywebio.output import *
html=c.render_notebook()
def main():
    put_html(html)
start_server(applications=main, port=8888)
上一篇:pyechart实现双柱双线及交互式漏斗图


下一篇:pyechart数据可视化13 数据大屏 仪表盘 添加不同背景图丨2021年中国彩票销售额