title: Display of specific colors
body: <p>I am working on color classification. I'm initializing a matrix with a particular color so that I can get a 16x16 matrix of red or blue or green. The code is as follows:</p>
  
  <pre><code> library(rgl)
      color1 &lt;- function()
     {
        n &lt;- 3
        m &lt;- 16
        a &lt;- list("numeric", n)
        wij &lt;- matrix(list(), nrow = m, ncol = m)
  
        #Initailize the weight matrix
        for(x1 in 1:m)
        {
          for(x2 in 1:m)
          {
            a&lt;-c(1,255,1)
            # a&lt;- c(255,1,1)
            #a&lt;-c(1,1,255)
            wij[[x1,x2]] &lt;- a
            rgl.spheres(x=x1, y=x2, col=wij[[x1,x2]], radius = 1 )
          }
        }
      }    
      color1() 
  </code></pre>
  
  <p>For this code, I'm supposed to get a 16x16 matrix of green color, for which I'm getting black color. The same way for the commented lines.<br>
  1, 1, 255 I'm getting black instead of blue.<br>
  255, 1, 1 I'm getting yellow instead of red. </p>
  
  <p>For two different values (1,1,255 and 1,255,1) I'm getting black color, for which I expected to get blue and green respectively. </p>
  
  <p>I need to specify the values from 0:255, but if I give a zero I get the following error: </p>
  
  <blockquote>
    <p>Error in col2rgb(colors) : numerical color values must be positive</p>
  </blockquote>
  
  <p>So I'm specifying the values from 1:255. Please can anybody help me in getting the required color for a specific value?</p>