A simple Jupyter (Lab/Notebook) wrapper of Jason Davies d3 JS wordcloud generator https://www.jasondavies.com/wordcloud/
pip install d3wordcloud
Displays the interactive SVG wordcloud right in your Jupyter Notebook (or Jupyter Lab).
import d3wordcloud as d3wc
d3wc.display_wordcloud(sample_data, show_settings=False)
sample_data
is a space-separated string, e.g."energy fossil fuel EU"
show_settings
shows the original settings for interactive control in your notebook, just like in the original version
If you'd like to use all the customization the library offers, either use the manual mode or build a modified wheel yourself.
For the manual mode, simply copy the manual
folder with the two files to your working directory and edit the html template directly.
git clone https://github.com/do-me/d3wordcloud.git
cd d3wordcloud
python setup.py sdist
tar tzf dist/d3wordcloud-0.0.1.tar.gz
python setup.py bdist_wheel sdist
cd dist
pip install d3wordcloud-0.0.1-py3-none-any.whl
Uninstalling is as easy as
pip uninstall d3wordcloud-0.0.1-py3-none-any.whl
If you are using a virtual env (like conda env) and the wordcloud SVG is not showing it is probably related to a Jupyter bug. A possible workaround is working in just one notebook at a time
- Port all the settings for full control in Python.