pal: Generate a palette of colours - possibly superseded

Usage Arguments Examples

Usage

1
pal(col = c("blue", "pink"), border = "light gray", ...)

Arguments

col
border
...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (col = c("blue", "pink"), border = "light gray", ...) 
{
    n <- length(col)
    plot(0, 0, type = "n", xlim = c(0, 1), ylim = c(0, 1), axes = FALSE, 
        xlab = "", ylab = "", ...)
    rect(0, 0:(n - 1)/n, 0.6, 1:n/n, col = col, border = border)
    ret <- col2rgb(col)
    dimnames(ret)[[2]] <- col
    ret <- t(ret)
    txt <- paste(as.character(col), "(", apply(ret, 1, paste, 
        collapse = " "), ")")
    text(rep(0.6, n), (0:(n - 1) + 0.5)/n, txt, adj = 0)
    ret <- col2rgb(col)
    dimnames(ret)[[2]] <- col
    t(ret)
  }

gmonette/spida15 documentation built on May 17, 2019, 7:26 a.m.