mypalette | R Documentation |
A nice, pastel color palette
mypalette(n = NULL, transparent = "99", alpha = NULL)
f2pal(f, palfunc = mypalette, ...)
f2leg(f, palfunc = mypalette, ...)
n |
length of palette to return. If longer than the number of
colors in the return value of |
transparent |
a character value to be pasted to each of the RGB color specifications in the palette indicating transparency ("00" for full transparency, "ff" for full opacity) |
alpha |
same as "transparent", but an alphanumeric value from 0..1. Takes precedence over "transparent" |
f |
a vector |
A nice, pastel color palette. The f2pal
and f2leg
convert
factors to colors. f2pal
converts a factors to colors directly,
while f2pal
returns a data frame with one column corresponding to
factor levels, and another to the respective colors. This way it is
possible to use it in legends. If the parameter f
is not a
factor, it will be converted to a factor.
mypalette
returns character vector with RGB color
specifications. f2pal
returns a character vector of RGB colors.
f2leg
returns a data frame with columns "text" and "col"
let <- sample(LETTERS[1:4], 50, replace=TRUE)
col <- f2pal(let)
plot(runif(50), runif(50), pch=19, col=col, cex=2)
leg <- f2leg(let)
legend("topleft", leg$text, pch=19, col=leg$col)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.