WordCloud.add()方法简介:
add(name,attr,value,
shape="circle",
word_gap=20,
word_size_range=None,
rotate_step=45)
name str
图例名称attr list
属性名称value list
属性所对应的值shape
词云图轮廓 对应属性可选'circle
', 'rect
', 'roundRect
', 'triangle
', 'diamond
', 'pin
', 'arrow
'word_gap int
字符间隔默认为20word_size_range
字符范围默认为[12,60]rotate_step int
旋转角度默认为45name = [ '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 Ellen Mark', 'Farrah Abraham', 'Rita Ora', 'Serena Williams', 'NCAA baseball tournament', 'Point Break'] value = [ 10000, 6181, 4386, 4055, 2467, 2244, 1898, 1484, 1112, 965, 847, 582, 555, 550, 462, 366, 360, 282, 273, 265] wordcloud = WordCloud(width=1300, height=620) wordcloud.add("我爱新中国", name, value, word_size_range=[30, 60]) page.add(wordcloud) wordcloud2 = WordCloud(width=1300, height=620) wordcloud2.add("", name, value, word_size_range=[30, 100], shape='diamond',word_gap=60)
from pyecharts import Page from pyecharts import WordCloud page = Page() #词云(词云图) ''' WordCloud.add()方法简介 add(name,attr,value, shape="circle", word_gap=20, word_size_range=None, rotate_step=45) name str 图例名称 attr list 属性名称 value list 属性所对应的值 shape 词云图轮廓 对应属性可选'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow' word_gap int 字符间隔默认为20 word_size_range 字符范围默认为[12,60] rotate_step int 旋转角度默认为45 ''' name = [ '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 Ellen Mark', 'Farrah Abraham', 'Rita Ora', 'Serena Williams', 'NCAA baseball tournament', 'Point Break'] value = [ 10000, 6181, 4386, 4055, 2467, 2244, 1898, 1484, 1112, 965, 847, 582, 555, 550, 462, 366, 360, 282, 273, 265] wordcloud = WordCloud(width=1300, height=620) wordcloud.add("我爱新中国", name, value, word_size_range=[30, 60]) page.add(wordcloud) wordcloud2 = WordCloud(width=1300, height=620) wordcloud2.add("", name, value, word_size_range=[30, 100], shape='diamond',word_gap=60) page.add(wordcloud2) page.render()
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
长按识别二维码并关注微信
更方便到期提醒、手机管理