通过pyecharts制作云词以及饼图
程序员文章站
2022-05-27 09:35:47
...
代码如下
云词代码
from pyecharts import WordCloud
name_list = ['Sam S Club', 'Macys', 'Amy Schumer', 'Jurassic World',
'Charter Communications','Chick Fil A', 'Planet Fitness',
'Pitch Perfect', 'Express','Home', 'Johnny Depp',
'Lena Dunham', 'Lewis Hamilton', 'KXAN', 'Mary EllenMark',
'Farrah Abraham','Rita Ora', 'Serena Williams',
'NCAA baseball tournament','Point Break']
value_list = [10000, 6181, 4386, 4055, 2467, 2244,
1898, 1484, 1112,965, 847, 582, 555,
550, 462, 366, 360, 282, 273, 265]
wordcloud = WordCloud(width=800, height=500)
wordcloud.add("", name_list, value_list, word_size_range=[20, 100])
wordcloud.render('词云.html')
饼图代码
from pyecharts import Pie
x = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
y = [11, 12, 13, 10, 10, 10]
pie = Pie("饼图示例")
pie.add("",x,y,is_label_show=True)
pie.render('饼图1.html')
上一篇: 帮忙看一个函数,该怎么处理
推荐阅读