Skip to content

Commit

Permalink
Update dispersion.py
Browse files Browse the repository at this point in the history
Fix order of words in y-axis of dispersion_plot
  • Loading branch information
chbrandt committed May 4, 2023
1 parent 56bc4af commit d7f5e86
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nltk/draw/dispersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def dispersion_plot(text, words, ignore_case=False, title="Lexical Dispersion Pl
xs.append(x)
ys.append(y)

words = list(word2y.keys())

_, ax = plt.subplots()
ax.plot(xs, ys, "|")
ax.set_yticks(list(range(len(words))), words, color="C0")
Expand Down

0 comments on commit d7f5e86

Please sign in to comment.