Drawing sina plots with ggforce
Do you remember Chapter 3, Plotting a Discrete Predictor and a Continuous Response when we tried jitter geometry to replace dot plots? A clear con was that it did not gave away any hint about the distribution format. Remember little difficulties with coloring some dot plots? Both could be contoured by ggforce
's sina geometry.
This recipe is designed to show an alternative way to visualize car::Salaries
data frame and also to hand a little teaser about geometries coming from ggforce
. We're about to explore a plot called sina, use it wisely.
Getting Ready
The devtools
package is required to install ggforce
from GitHub while car
holds the data frame:
> if(!require(devtools)){install.packages('devtools')} > if(!require(ggforce)){devtools::install_github('thomasp85/ggforce')} > if(!require(car)){install.packages('car')}
The car::Salaries
data frame is the one we will be using for now.
How to do it...
We can proceed with the recipe as follows:
- Load both
ggforce...