zoukankan      html  css  js  c++  java
  • 小白学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')

  • 相关阅读:
    leetCode 移动零 问题记录
    leetCode 加一 问题记录
    leetCode 两个数组的交集 II 问题记录
    leetCode 只出现一次的数字 问题记录
    leetCode 旋转数组 问题记录
    将本地项目上传到git
    RabbitMQ Linux 安装教程
    springboot RabbitMQ 配置
    linux——mysql5.5 安装遇到问题总结&解决方式
    Js预编译 GO和AO活动对象
  • 原文地址:https://www.cnblogs.com/adam012019/p/11395840.html
Copyright © 2011-2022 走看看