Description Usage Arguments Details Value Author(s) See Also Examples
Replace a vector of numbers by a vector of colors from a palette, such that values correspond to the colors on a smooth gradient.
1 2 |
x |
A numeric vector |
pal |
Character vector containing the color gradient onto which the
numeric vector |
max |
Values of |
min |
Values of |
n |
Number of steps |
palfunc |
Palette function returned by colorRampPalette |
na.color |
NA values will be replaced by that color |
This function is used to map a continues numerical vector on an ordinal character vector, in especially a vector of colors. Color palette can be specified using an RColorBrewer palette name.
A character vector of the same length as the numeric vector
x
, containing the matching colors.
January Weiner <january.weiner@gmail.com>
1 2 3 4 5 6 7 8 9 10 | smoothPalette( 1:3 )
# will print:
# "#CCCCCC" "#666666" "#000000"
smoothPalette( 1:3, pal= "Blues" )
# will produce:
# "#F7FBFF" "#6BAED6" "#08306B"
x <- runif( 100 )
plot( 1:100, x, col= smoothPalette( x, pal= "BrBG" ), pch= 19 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.