利用 Pyecharts 制作词云图

利用 Pyecharts 制作词云图:

from pyecharts import options as opts
from pyecharts.charts import Page, WordCloud
from pyecharts.globals import SymbolType
words = [
    ("Python", 100),
    ("C++", 80),
    ("Java", 95),
    ("R", 50),
    ("JavaScript", 79),
    ("C", 65)
]
def wordcloud() -> WordCloud:
    c = (
        WordCloud()
        # word_size_range: 单词字体大小范围
        .add("", words, word_size_range=[20, 100], shape="cardioid")
        .set_global_opts(title_opts=opts.TitleOpts(title="WordCloud"))
    )
    return c

wordcloud().render('G:/PythonWorkSpace/MatplotlibNumpyPandas/wordcloud.html')

(“C”,65)表示在本次统计中C语言出现65次
在这里插入图片描述

发布了49 篇原创文章 · 获赞 76 · 访问量 2698

猜你喜欢

转载自blog.csdn.net/qq_39783601/article/details/104665667
今日推荐