Preparations
In the following exercises, we'll aim to make the plot shown in the viewer. Here, we'll establish our positions and base layer of the plot.
Establishing these items as independent objects will allow us to recycle them easily in many layers, or plots.
position_jitter()adds jittering (e.g. for points).position_dodge()dodges geoms, (e.g. bar, col, boxplot, violin, errorbar, pointrange).position_jitterdodge()jitters and dodges geoms, (e.g. points).
As before, we'll use mtcars, where fcyl and fam are proper factor variables of the original cyl and am variables.
Questo esercizio fa parte del corso
Intermediate Data Visualization with ggplot2
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Define position objects
# 1. Jitter with width 0.2
posn_j <- ___
# 2. Dodge with width 0.1
posn_d <- ___
# 3. Jitter-dodge with jitter.width 0.2 and dodge.width 0.1
posn_jd <- ___