Drawing bivariate dot plots using ggplot2
Dot plots are commonly used to plot univariate discrete distributions. Dots are stacked and each dot represents a fixed number of occurrences. However, that is not the only usage. They can also represent bivariate and multivariate relations. ggplot2
has a function fully dedicated to draw dot plots, but there are alternatives. They can also drawn by using geom_point()
or geom_jitter()
instead, as later recipes will demonstrate. They can also be seen as supplemental devices to box and violin plots.
This recipe teaches how to use the fully dedicated function, geom_dotplot()
, in order to create simple dot plots. It also highlights an important aspect of dot plots built this way, proportions.
Getting ready
Data will come out from the car
package:
> if( !require(car)){ install.packages('car')}
Once it's ready, the recipe is good to go.
How to do it...
Let us get started with drawing bivariate dot plots using ggplot2
:
- Use
geom_dotplot()
to draw a simple box plot...