Lexical Dispersion Plots let you visualize the distribution of words within a document. Let’s say you write an essay on the topic of evolution. If you do, you should talk about the theory of natural selection, darwin, and species. A lexical dispersion plot lets you visualize the occurences of these words within your essay.

To visualize these plots I wrote a little shiny app that lets you input your own texts and analyze them. You can find the code here.

First, you need to paste in your text. What you see in the following image is the Wikipedia article of the theory of evolution:

Then you need some keywords you are interested in. I picked evolution, darwin, selection, theory, and species. The keywords should be separated by a comma. Since all words are converted to lowercase, you don’t have to worry about uppercase and lowercase.

Hit the Analyze text button and what you get is the lexical dispersion plot:

The app is not perfect. For example, I have not formed lexical lemmata from the words. Hence, theory and theories would be visualized seperately on the y-axis. Another caveat is that the app only works with 1-grams. 2-grams like Charles Darwin cannot be tracked. Still, I hope you have fun analyzing some texts with the app.