title: Axis labels for each bar and each group in bar charts with dodged groups
body: <p>I would like to create a bar chart using <code>ggplot2</code> with dodged groups and axis labels for both the bars (male, female) and the groups (Study 1, Study 2...). Here is how I would like my chart to look:</p>
  
  <p><img src="https://i.stack.imgur.com/7JQdQ.png" alt="enter image description here"></p>
  
  <p>And some R code. In this case, only the groups are labeled on the axis (not the bars within the group). The bar labels in the axis basically replace the legend. </p>
  
  <pre><code>x      = runif(8)
  gender = factor(c("male","female","male","female","male","female","male","female"))
  group  = c(0,0,1,1,2,2,3,3)
  df     = data.frame(x,gender,group)
  
  ggplot(df,aes(x=group,y=x,fill=gender)) + 
      geom_bar(stat="identity",position="dodge") + 
      scale_x_continuous("",breaks=c(0:3),
          labels=c('G1','G2','G3','G4'))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/gt1f7.png" alt="enter image description here"></p>