brewcol | R Documentation |
Assign a specified number of Color Brewer colors to a collection of values.
brewcol( x, n = 9, name = c("YlGnBu", "Oranges", "Greens", "Blues", "Greys", "Dark2")[1] )
x |
A numeric vector of values to which colors will be assigned. |
n |
An integer scalar indicating the number of unique colors to be assigned,
default 9. The range of possible values depends on the palette named,
typically |
name |
A character scalar indicating the palette name to be passed to
|
A character vector of colors expressed as hexadecimal values with a "#" prefix.
x <- 1:20 mycol <- brewcol(x, 4, "Dark2") plot(x, x, col=mycol, pch=16, cex=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.