colors()
function colors()
function. Invoking colors()
returns a 657 element character vector, where each element of the vector is a specific color name. The colors()
function can als be used in conjunction with the [ ]
subsetting operators to extract a specific subset of color names. For example,
colors()
function.
plot(c(-1,x),c(-1,y), xlab='', ylab='', type='n', xaxt='n', yaxt='n', bty='n') for(i in 1:x){for(j in 1:y){ k <- y*(i-1)+j ; co <- colors()[k] rect(i-1, j-1, i, j, col=co, border=1)}}
text(rep(-.5,y),(1:y)-.5, 1:y, cex=1.2-.016*y) text((1:x)-.5, rep(-.5,x), y*(0:(x-1)), cex=1.2-.022*x) title('col=colors()[n]') }
show.colors()