首页 > 编程语言 > 详细

小白学Python(12)——pyecharts ,生成词云图 WordCloud

时间:2019-08-22 19:06:06      阅读:1194      评论:0      收藏:0      [点我收藏+]

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(12)——pyecharts ,生成词云图 WordCloud

原文:https://www.cnblogs.com/adam012019/p/11395840.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!