wordcloud(s: pandas.core.series.Series, font_path: str = None, width: int = 400, height: int = 200, max_words=200, mask=None, contour_width=0, contour_color='PAPAYAWHIP', background_color='PAPAYAWHIP', relative_scaling='auto', colormap=None, return_figure=False)¶
Plot wordcloud image using WordCloud from word_cloud package.
Most of the arguments are very similar if not equal to the mother function. In constrast, all words are taken into account when computing the wordcloud, inclusive stopwords. They can be easily removed with preprocessing.remove_stopwords.
Word are compute using generate_from_frequencies.
Font path to the font that will be used (OTF or TTF). Defaults to DroidSansMono path on a Linux machine. If you are on another OS or don’t have this font, you need to adjust this path.
Width of the canvas.
Height of the canvas.
- max_wordsnumber (default=200)
The maximum number of words.
- masknd-array or None (default=None)
When set, gives a binary mask on where to draw words. When set, width and height will be ignored and the shape of mask will be used instead. All white (#FF or #FFFFFF) entries will be considerd “masked out” while other entries will be free to draw on.
- contour_width: float (default=0)
If mask is not None and contour_width > 0, draw the mask contour.
- contour_color: color value (default=”PAPAYAWHIP”)
Mask contour color.
- min_font_sizeint (default=4)
Smallest font size to use. Will stop when there is no more room in this size.
- background_colorcolor value (default=”PAPAYAWHIP”)
Background color for the word cloud image.
- max_font_sizeint or None (default=None)
Maximum font size for the largest word. If None, height of the image is used.
- relative_scalingfloat (default=’auto’)
Importance of relative word frequencies for font-size. With relative_scaling=0, only word-ranks are considered. With relative_scaling=1, a word that is twice as frequent will have twice the size. If you want to consider the word frequencies and not only their rank, relative_scaling around .5 often looks good. If ‘auto’ it will be set to 0.5 unless repeat is true, in which case it will be set to 0.
- colormapstring or matplotlib colormap, default=”viridis”
Matplotlib colormap to randomly draw colors from for each word.