Using point geometry to work as dots using ggvis, plotly and ggplot2

Dot plots can be seen as binned scatterplots. Once you realize it, you also realize that the point geometry coming from all three packages (ggplot2, plotly, and ggvis) can be used to draw sort of dot plots (not actual dot plots). ggplot2 can do this very easily. For ggvis and plotly, there are few key steps to follow:

  1. Coerce the categories into numbers, so x will behave as continuous.
  2. Add some little noise to x but not to y.
  3. Draw a scatterplot using x and y.
  4. Relabel the x-axis in order to reference categories.

This recipe is using runif() to create the noise and some tricks to re-label the ticks. Next section tells the requirements.