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:
- Coerce the categories into numbers, so x will behave as continuous.
- Add some little noise to x but not to y.
- Draw a scatterplot using x and y.
- 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.
Skip to the next section if you are sure about having car
package installed. If you don't please run the following code:
> if( !require(car)){ install.packages('car')}
Having the car
package installed is still a requirement.