title: grouping labels in ggplot
body: <p>Here's my attempt to create a heatmap using <code>ggplot2</code>.</p>
  
  <pre><code>#DATA
  set.seed(42)
  df1 = data.frame(ID = paste0("I", 1:40),
                   group = rep(c("Dry", "Rain"), each = 20),
                   subgroup = rep(paste0("S", 1:4), each = 10),
                   setNames(data.frame(replicate(8, rnorm(40))), letters[1:8]))
  library(reshape2)
  df1 = melt(df1, id.vars = c("ID", "group", "subgroup"))
  df1 = df1[order(df1$group, df1$subgroup),]
  df1$fact = paste(df1$subgroup, df1$ID)
  df1$fact = factor(df1$fact, levels = unique(df1$fact))
  
  #PLOT
  library(ggplot2)
  ggplot(df1, aes(x = variable, y = fact, fill = value)) +
      geom_tile() +
      scale_y_discrete(labels = df1$subgroup[!duplicated(df1$ID)])
  </code></pre>
  
  <p>The plot is exactly what I want except for the fact that the labels <code>S1</code>, <code>S2</code>, <code>S3</code>, and <code>S4</code> repeat 10 times each. Is there a way to display them only one time and then put some kind of break between <code>S1</code>, <code>S2</code>, <code>S3</code>, and <code>S4</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/3rAnT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3rAnT.png" alt="enter image description here"></a></p>
  
  <p>I am also curious if there is way to put <code>group</code> to the left of <code>subgroup</code> in the plot as a secondary y-axis but that is optional.</p>