Python package and CLI to generate stylistic word clouds
以下为 快照 页面，建议前往来源网站查看，会有更好的阅读体验。
Generate stylistic wordclouds, including gradients and icon shapes!
stylecloud is a Python package that leverages the popular word_cloud package, adding useful features to create truly unique word clouds!
- Icon shapes (of any size!) for wordclouds (via Font Awesome 5.11.2)
- Support for advanced color palettes (via palettable )
- Directional gradients w/ the aforementioned palettes.
- Supports reading a file of text, or reading a pre-generated CSV with words and counts.
- Command Line Interface!
This package is a more formal implementation of my stylistic word cloud project from 2016.
You can install stylecloud via pip:
pip3 install stylecloud
You can use stylecloud in a Python script or as a standalone CLI app. For example, let's say you have a text of the U.S. Constitution
import stylecloud stylecloud.gen_stylecloud(file_path='constitution.txt')
But you can do so much more! You can use the free Font Awesome icons to change the shape, change the color palette to one from palettable for a custom style, change the background color, and, most importantly, add a gradient so the colors flow in a specified direction!
import stylecloud stylecloud.gen_stylecloud(file_path='constitution.txt', icon_name='fas fa-dog', palette='colorbrewer.diverging.Spectral_11', background_color='black', gradient='horizontal')
You can also use the CLI for even faster stylecloud generation! For the simple flag stylecloud above:
stylecloud --file_path constitution.txt
For the more complex dog-gradient stylecloud:
stylecloud --file_path constitution.txt --icon_name 'fas fa-dog' --palette colorbrewer.diverging.Spectral_11 --background_color black --gradient horizontal
You can find more examples of styleclouds, including how to make styleclouds from Twitter and Reddit data, in the stylecloud-examples repo.
In order to deal with different languages or simply add list of custom stopwords it is possible to pass a list contained in a string as parameter like so :
stylecloud --file_path constitution.txt --custom_words "[thereof, may, state, united states]"
For more control it would of course be most ideal to define the list in code since if one is defining stopwords for another language these lists can get long. In that case simply pass in the list as argument to the function
import stylecloud my_long_list = ["thereof", "may", "state", "united states"] stylecloud.gen_stylecloud(file_path=constitution.txt, custom_words=my_long_list)
These parameters are valid for both the Python function and the CLI (you can use
stylecloud -h to get this information as well).
None 512 fas fa-flag cartocolors.qualitative.Bold_6 white 200 2000 True STOPWORDS stylecloud.png
- The primary goal of this package is to create data visualizations of text that provide a unique aesthetic. Word clouds have tradeoffs in terms of a statistically robust data visualization, but this is explicitly prioritizing coolness!
- This package is released as a separate package from
word_clouddue to the increase in scope and Python dependencies.
- The ideal fonts for generating a good stylecloud are a) bold/high weight in order to increase readability, and b) condensed/low kerning to fit more text. Both of these traits are why Staatliches is the default font for stylecloud (overriding Droid Sans in the base
- You may want to consider doing post-processing after generating a stylecloud: for example, adding color masks, adding perception skew, feed it to a style transfer AI model, etc.
- The default
200is calibrated for the default
512. If you increase the
size, you may want to consider increasing
- Due to the size of the included Font Awesome font files, they will not be updated on every new minor FA release.
- It's recommended to use FA icons which are large with heavy weight; thin icons might constrain the text too much.
- If using the default random-color-sampling method, it's recommended to use a qualitative palette. Inversely, if using a gradient, it's recommended to use a non qualitative palette (e.g. a sequential palette).
- Support custom font files (e.g. Font Awesome Pro)
- Create an app running stylecloud
Max Woolf ( @minimaxir )
Max's open-source projects are supported by his Patreon and GitHub Sponsors. If you found this project helpful, any monetary contributions to the Patreon are appreciated and will be put to good creative use.
Font Awesome icon font files included per the terms in its SIL OFL 1.1 License .
Staatliches font included per the terms in its SIL OFL 1.1 License .
webgl-wireframes - Stylistic Wireframe Rendering in WebGL
dotp dotp is a dart package to generate and verify one-time passwords that were used to implement 2FA and MFA authentication method in web applications and other login-required systems. ...
By:Siddharth Mehta | Last Updated: 2019-01-25 | | Related Tips:More > Power BI Problem The Power...
Introduction On April 16, 2018, the Python Packaging Authority (PyPA) deployed a new version of PyPI (pronounced pie-pea-eye ), the official online repository of Python projects. The domain
“There were 5 Exabytes of information created between the dawn of civilization through 2003, but that much information is now created every 2 days”:Eric Schmidt If you a...
README.rst pip - The Python Package Installer
covimerage - Generate coverage information for Vim scripts.
caddy-docker - Generate Caddy configuration on-the-fly from currently running Docker containers
Generate minimaps of your code