Exemplo n.º 1
0
def test_wordcloud():

    # wordcloud_0
    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, 100], rotate_step=66)
    wordcloud.show_config()
    wordcloud.render()

    # wordcloud_1
    wordcloud = WordCloud(width=1300, height=620)
    wordcloud.add("", name, value, word_size_range=[30, 100], shape='diamond')
    wordcloud.show_config()
    wordcloud.render()
def world_cloud_test(d, num):
    X = pd.Series(unique(d)).values
    Y = pd.Series(num.groupby(d).sum()).values
    wordcloud = WordCloud("", width=1300, height=620)
    wordcloud.add("", X, Y, word_size_range=[20, 100])
    wordcloud.show_config()
    wordcloud.render("E:\\py_data_html\\world_cloud_test.html")
def worldCould_test(c, b):
    name = pd.Series(unique(c)).values
    g1 = b.groupby(c).sum().round(2).values
    value = pd.Series(g1).values
    worldCoule = WordCloud(width=1200, height=400)
    worldCoule.add("2018年10月到2019年10月香飘飘各品项出库数据-云词分布",
                   name,
                   value,
                   word_size_range=[20, 100])
    worldCoule.show_config()
    worldCoule.render("E:\\py_data_html\\bar_test015_4.html")
    print("生成完成")
Exemplo n.º 4
0
def test_wordcloud():

    # wordcloud_0
    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, 100], rotate_step=66)
    wordcloud.show_config()
    wordcloud.render()

    # wordcloud_1
    wordcloud = WordCloud(width=1300, height=620)
    wordcloud.add("", name, value, word_size_range=[30, 100], shape='diamond')
    wordcloud.show_config()
    wordcloud.render()
Exemplo n.º 5
0
radar.render(path='./data/03-05雷达图.html')
"""
#支持保持成各种格式,但是会有问题
bar = Bar("我的第一个图表", "这里是副标题")
bar.add("服装", ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90])
# bar.print_echarts_options()
bar.render(path='snapshot.html')
bar.render(path='snapshot.png')
bar.render(path='snapshot.pdf')
"""

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=[20, 100])
wordcloud.show_config()
wordcloud.render(path='./data/05-01权重词云.html')

wordcloud2 = WordCloud(width=1300, height=620)
wordcloud2.add("", name, value, word_size_range=[30, 100], shape='diamond')
wordcloud2.show_config()
wordcloud2.render(path='./data/05-02变形词云.html')
Exemplo n.º 6
0
# geo.add_coordinate("cn", 119.3, 26.08)
# geo.show_config()
# geo.render(render_address)

# scatter3D
# import random
# page = Page()
# data = [[random.randint(0, 100), random.randint(0, 100), random.randint(0, 100)] for _ in range(80)]
# range_color = ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf',
#                '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
# scatter3D = Scatter3D("3D 散点图示例", width=1200, height=600)
# scatter3D.add("", data, is_visualmap=True, visual_range_color=range_color)
# page.add(scatter3D)
# page.render(render_address)

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 = [
    7000, 6181, 4386, 4055, 2467, 2244, 1898, 1484, 1112, 965, 847, 582, 555,
    550, 462, 366, 360, 282, 273, 265
]
word_cloud = WordCloud(width=1300, height=620)
word_cloud.add("", name, value, word_size_range=[20, 100])
word_cloud.show_config()
word_cloud.render(render_address)
Exemplo n.º 7
0
import pyecharts
from pyecharts import WordCloud

myWordCloud = WordCloud("绘制词云", width=1000, height=620)
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
]
myWordCloud.add("", name, value, word_size_range=[20, 100])

myWordCloud.show_config()
myWordCloud.render()