pycounter_tecimer.plotting

Module Contents

Functions

plot_words(word_counts[, n])

Plot a bar chart of word counts.

pycounter_tecimer.plotting.plot_words(word_counts, n=10)[source]

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 pycounter_tecimer.pycounter_tecimer import count_words
>>> from pycounter_tecimer.plotting import plot_words
>>> counts = count_words("text.txt")
>>> plot_words(counts)