I have a simple bar graph in ggplot, with two factor variables on the x axis:
library(ggplot2)
dat <- data.frame(group1= c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),
group2= rep(1:4,4),
val = 1:16)
ggplot(dat, aes(x=group1,y=val,group=group2))+
geom_bar(stat="identity", position="dodge")
What is the simplest way to add a second x axis label (for group2)? There is a more complex version of this question here, but I don't see how to apply this logic to this simple case.