title: Adding a Dendrogram to a ggplot2 Heatmap
body: <p>New R user here. 
  I am trying to add a dendrogram to this heatmap that I created using ggplot2. How can I do that? I have added my code to the heat map below.</p>
  
  <pre><code>#Mtcars using ggplots and reshape2 
  install.packages("ggplot2")
  library(ggplot2)
  intall.packages("reshape2")
  library(reshape2)
  data(mtcars)
  Cars &lt;- mtcars[c(1:7)] #subset to 6 genres
  
  cor(Cars) # 6x6 cor matrix
  
  #ggplot likes the data 'melted' one value per row
  m &lt;-melt(cor(Cars)) 
  p &lt;- ggplot(data=m, aes(x=Var1, y=Var2, fill=value)) + geom_tile()
  p
  
  #set up a coloring scheme using colorRampPalette
  red=rgb(1,0,0); green=rgb(0,1,0); blue=rgb(0,0,1); black=rgb(0,0,0)
  RtoBrange&lt;-colorRampPalette(c(red, black ) )
  BtoGrange&lt;-colorRampPalette(c(black, green) ) 
  
  p &lt;- p + scale_fill_gradient2(low=RtoBrange(100), mid="black",           high=BtoGrange(100))
  p
  </code></pre>
  
  <p>Thanks for your help,</p>
  
  <p>Charlotte</p>