.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_single_word.py: Single Word =========== Make a word cloud with a single word that's repeated. .. image:: /auto_examples/images/sphx_glr_single_word_001.png :alt: single word :class: sphx-glr-single-img .. code-block:: default import numpy as np import matplotlib.pyplot as plt from wordcloud import WordCloud text = "square" x, y = np.ogrid[:300, :300] mask = (x - 150) ** 2 + (y - 150) ** 2 > 130 ** 2 mask = 255 * mask.astype(int) wc = WordCloud(background_color="white", repeat=True, mask=mask) wc.generate(text) plt.axis("off") plt.imshow(wc, interpolation="bilinear") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.516 seconds) .. _sphx_glr_download_auto_examples_single_word.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: single_word.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: single_word.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_