title: How to easily visualize a matrix?
body: <p>When doing matrix operations, I would like to be able to see what the results of my calculations are, at least to get a rough idea of the nature of the matrices going in and coming out of the operation.</p>
  
  <p>How can I plot a matrix of real numbers, so that the x axis represents columns, the y represents rows, and the color or size of a point represents the cell value?</p>
  
  <p>Ultimately, I would like to display multiple plots, e.g. the right and left hand sides of an equation.</p>
  
  <p>Here is some example code:</p>
  
  <pre><code>a &lt;- matrix(rnorm(100), ncol = 10)
  b &lt;- diag(1,10)
  c &lt;- a*b
  
  par(mfrow = c(1,3))
  plot.matrix.fn &lt;- function(m) {
     #enter answer to this question here
  }
  lapply(list(a,b,c), plot.matrix.fn)
  </code></pre>
  
  <p>update: since posting this question, I found that there are some great examples here: <a href="https://stackoverflow.com/questions/3081066/what-techniques-exists-in-r-to-visualize-a-distance-matrix">What techniques exists in R to visualize a &quot;distance matrix&quot;?</a></p>