title: Converting a Number Matrix to a Color Matrix in R
body: <p>I have the following 4x4 number matrix containing the numbers 0-4:</p>
  
  <pre><code>0  1  0  3
  3  2  1  4
  4  1  0  2
  3  3  0  1
  </code></pre>
  
  <p>I would like to understand how to convert number matrices into a color matrices using chosen colors and specific square dimensions (length x width) using R. To be clear, I'm defining color matrix as a figure using colored squares to represent specific values in a matrix orientation. An example 4x4 from another program follows:</p>
  
  <p><img src="https://i.stack.imgur.com/dYzxY.jpg" alt="enter image description here"></p>
  
  <p>I would have to assign color codes to the numbers, for example:</p>
  
  <pre><code>0 = FFFFFF
  1 = 99FF66
  2 = 66FF33
  3 = 33CC00
  4 = 009900
  </code></pre>
  
  <p>But I don't know where to begin putting this together. I imagine I would also have to specify dimensions for color squares as well.</p>
  
  <p>My goal is to be able to import a data frame into R with up to 10 numerical values and create these color charts for matrices as large as 20x20.</p>