pycounts_radifar.plotting#

Module Contents#

Functions#

plot_words(→ Type[matplotlib.pyplot.bar])

Plot a bar chart of word counts.

pycounts_radifar.plotting.plot_words(word_counts: Type[collections.Counter], n: int = 10) Type[matplotlib.pyplot.bar]#

Plot a bar chart of word counts.

Parameters:
  • word_counts (collections.Counter) – Counter object of word counts.

  • n (int, optional) – Plot the top n words. By default, 10.

Returns:

Bar chart of word counts.

Return type:

matplotlib.container.BarContainer

Examples

>>> from pycounts.pycounts import count_words
>>> from pycounts.plotting import plot_words
>>> counts = count_words("text.txt")
>>> plot_words(counts)