小白学Python(12)——pyecharts ,生成词云图 WordCloud
WordCloud(词云图)
1 from pyecharts import options as opts 2 from pyecharts.charts import Page, WordCloud 3 from pyecharts.globals import SymbolType 4 5 6 words = [ 7 ("Sam S Club", 10000), 8 ("Macys", 6181), 9 ("Amy Schumer", 4386), 10 ("Jurassic World", 4055), 11 ("Charter Communications", 2467), 12 ("Chick Fil A", 2244), 13 ("Planet Fitness", 1868), 14 ("Pitch Perfect", 1484), 15 ("Express", 1112), 16 ("Home", 865), 17 ("Johnny Depp", 847), 18 ("Lena Dunham", 582), 19 ("Lewis Hamilton", 555), 20 ("KXAN", 550), 21 ("Mary Ellen Mark", 462), 22 ("Farrah Abraham", 366), 23 ("Rita Ora", 360), 24 ("Serena Williams", 282), 25 ("NCAA baseball tournament", 273), 26 ("Point Break", 265), 27 ] 28 29 worldcloud=( 30 WordCloud() 31 .add("", words, word_size_range=[20, 100]) 32 .set_global_opts(title_opts=opts.TitleOpts(title="WordCloud-基本示例")) 33 ) 34 worldcloud.render('word.html')
1 from pyecharts import options as opts 2 from pyecharts.charts import Page, WordCloud 3 from pyecharts.globals import SymbolType 4 5 6 words = [ 7 ("Sam S Club", 10000), 8 ("Macys", 6181), 9 ("Amy Schumer", 4386), 10 ("Jurassic World", 4055), 11 ("Charter Communications", 2467), 12 ("Chick Fil A", 2244), 13 ("Planet Fitness", 1868), 14 ("Pitch Perfect", 1484), 15 ("Express", 1112), 16 ("Home", 865), 17 ("Johnny Depp", 847), 18 ("Lena Dunham", 582), 19 ("Lewis Hamilton", 555), 20 ("KXAN", 550), 21 ("Mary Ellen Mark", 462), 22 ("Farrah Abraham", 366), 23 ("Rita Ora", 360), 24 ("Serena Williams", 282), 25 ("NCAA baseball tournament", 273), 26 ("Point Break", 265), 27 ] 28 29 worldcloud=( 30 WordCloud() 31 .add("", words, word_size_range=[20, 100], shape=SymbolType.DIAMOND) 32 .set_global_opts(title_opts=opts.TitleOpts(title="WordCloud-shape-diamond")) 33 ) 34 worldcloud.render('word.html')
标签:
Python自学
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)