词云图
from pyecharts.charts import WordCloud
def word1():
words= [
("Sam S Club", 10000),
("Macys", 6181),
("Amy Schumer", 4386),
("Jurassic World", 4055),
("Charter Communications", 2467),
("Chick Fil A", 2244),
("Planet Fitness", 1868),
("Pitch Perfect", 1484),
("Express", 1112),
("Home", 865),
("Johnny Depp", 847),
("Lena Dunham", 582),
("Lewis Hamilton", 555),
("KXAN", 550),
("Mary Ellen Mark", 462),
("Farrah Abraham", 366),
("Rita Ora", 360),
("Serena Williams", 282),
("NCAA baseball tournament", 273),
("Point Break", 265),
]
worldcloud = (
WordCloud()
.add("", words, word_size_range=[20, 100])
.set_global_opts(title_opts=opt.TitleOpts(title="WorldCloud-shape-diamond"))
)
# worldcloud = (
# WordCloud()
# .add("", words, word_size_range=[20, 100], shape=SymbolType.DIAMOND)
# .set_global_opts(title_opts=opt.TitleOpts(title="WorldCloud-shape-diamond"))
# )
worldcloud.render("wordl.html")
os.system("wordl.html")
效果如下:
散点图
from pyecharts.charts import Scatter