word_cloud_util

Support utilities for word cloud generation.

Functions

default_color_func(word, font_size, ...[, ...])

Update the current color fraction and wrap around if necessary.

generate_contour_svg(wc, width, height)

Generate an SVG contour mask based on a word cloud object and dimensions.

random_color_darker([random_state])

Random color generation function.

default_color_func(word, font_size, position, orientation, random_state=None, **kwargs)

Update the current color fraction and wrap around if necessary.

generate_contour_svg(wc, width, height)[source]

Generate an SVG contour mask based on a word cloud object and dimensions.

Parameters:
  • wc (WordCloud) – The word cloud object.

  • width (int) – SVG image width in pixels.

  • height (int) – SVG image height in pixels.

Returns:

SVG point list for the contour mask, or empty string if not generated.

Return type:

str

random_color_darker(random_state=None)[source]

Random color generation function.

Parameters:

random_state (Random or None) – Previous state of random generation for next color generation.

Returns:

Represents a hue, saturation, and lightness.

Return type:

str

Classes

ColormapColorFunc([colormap, color_range, ...])

Represents a colormap.