python模块详解 | wordcloud

今天是五一假期的第一天,学一点有意思的东西!

数据分析领域经常会用到统计与展示的功能需求,数据的展示方式,传统的有统计图之类,但稍显古板,对于文本来说,更加直观、带有一定艺术感的展示效果需求很大。对于这类需求,词云特有的展示方式深🉐️人心。

欣赏一下词云制作的样例图 - http://amueller.github.io/word_cloud/auto_examples/index.html#example-gallery

官方GitHub项目 - https://github.com/amueller/word_cloud

官方文档 - http://amueller.github.io/word_cloud/

今天就按「官方网站」的指引,来学习学习

这是作者对比其他词云工具时,给出的对wordcloud的评价:

  • filling all available space.
  • being able to use arbitraty masks.
  • having a stupid simple algorithm (with an efficient implementation) that can be easily modified.
  • being in Python

嗯,蛮好,可以开始下一页的学习了

API Reference

All functionality is encapsulated in the WordCloud class.(所有功能都封装在WordCloud类中。)

WordCloud([font_path, width, height, …]) Word cloud object for generating and drawing.
ImageColorGenerator(image[, default_color]) Color generator based on a color image.
WordCloud([font_path, width, height, …]) Random hue color generation.
get_single_color_func(color) Create a color function which returns a single hue and saturation with.

这一页,作者阐述了wordcloud模块的方法梗概,一共有四个,打开下一页一看,

image-20210501181212516

😲 😲

哇,所有的功能、方法、解释,作者已经整理得很好了,基本可以做到即查即用。而且,btw,很难得有官方文档写的如此思路清晰,观赏性之高,简直十分符合我的学习习惯 😄

那我还来整理个毛啊,直接去看作者的网站就得了。http://amueller.github.io/word_cloud/

本文完。

parrot_new(已去底)


511 字