title: How to show legend in heatmap?
body: <p>The problem is actually quite simple, yet I am not able to find a solution to it.</p>
  
  <p>How to plot a heatmap and its legend, i.e. a bar with the color scale representing the minimum and the maximum value that are plotted?</p>
  
  <p>I read the help of the <strong>heatmap()</strong> function, and using base R as explained here:</p>
  
  <p><a href="https://www.r-graph-gallery.com/215-the-heatmap-function.html" rel="noreferrer">r-graph-gallery.com heatmaps</a></p>
  
  <p>this is what I'm doing</p>
  
  <pre><code>heatmap(as.matrix(dataSet[, -1]), Colv = NA, Rowv = NA, scale="column", xlab="something", ylab="", main="A title", labRow=dataSet$labels, labCol=colnames(dataSet[, -1]), col= colorRampPalette(brewer.pal(8, "Oranges"))(25))
  </code></pre>
  
  <p>and it works perfectly, but still I would like to plot a legend. Is there a way to do that?</p>
  
  <p>this is a sample of the dataset which I'm working with. The first row is the header.</p>
  
  <pre><code>labels  6   1   4   8   3   2   9   7   5
  aaa1    2   2   11  0   0   0   0   0   0
  aaa2    3   3   16  0   0   0   0   0   0
  aaa3    1   4   15  0   0   0   0   0   0
  aaa4    1   6   17  0   0   0   0   0   4
  aaa10   1   2   16  0   0   0   0   0   0
  bbb11   1   0   2   0   1   2   1   0   0
  bbb12   0   1   10  1   0   1   2   3   0
  bbb13   1   0   0   0   2   0   0   0   0
  </code></pre>