Graphics Reference
In-Depth Information
Note that if there are any missing combinations of the categorical variables, that bar will be miss-
ing, and the neighboring bars will expand to fill that space. If we remove the last row from our
example data frame, we get Figure 3-6 :
ce <- cabbage_exp[ 1 : 5 , ]
# Copy the data without last row
ce
Cultivar Date Weight
c39 d16
3.18
c39 d20
2.80
c39 d21
2.74
c52 d16
2.26
c52 d20
3.11
ggplot(ce, aes(x = Date, y = Weight, fill = Cultivar)) +
geom_bar(position = "dodge" , colour = "black" ) +
scale_fill_brewer(palette = "Pastel1" )
Search WWH ::




Custom Search