.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/single_word.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` 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. .. GENERATED FROM PYTHON SOURCE LINES 7-26 .. image-sg:: /auto_examples/images/sphx_glr_single_word_001.png :alt: single word :srcset: /auto_examples/images/sphx_glr_single_word_001.png :class: sphx-glr-single-img .. code-block:: Python 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.142 seconds) .. _sphx_glr_download_auto_examples_single_word.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: single_word.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: single_word.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: single_word.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_