title: R heatmap combined with barplot
body: <p>I am trying to create a heatmap combined with a barplot, such that at the end of every row is a bar with length relevant to that row. The idea is to combine something like the following two into one:</p>
  <pre><code>library(gplots)
  data(mtcars)
  x  &lt;- as.matrix(mtcars[,2:11])
  hm&lt;-heatmap(x)
  barplot(mtcars[hm$rowInd,&quot;mpg&quot;],horiz=T,names.arg=row.names(mtcars)[hm$rowInd],las=2,cex.names=0.7,col=&quot;purple&quot;,2)
  </code></pre>
  <p>My question is how to combine the two while making the rows and bars align?
  Thanks.</p>
  <p><img src="https://i.stack.imgur.com/suxtt.png" alt="enter image description here" />
  <img src="https://i.stack.imgur.com/2cbAy.png" alt="enter image description here" /></p>