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.
Bu egzersiz
Intermediate Data Visualization with ggplot2
kursunun bir parçasıdırUygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# 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 <- ___