Description Usage Arguments Details Value See Also Examples
Return a color palette which can be used for plotting, with a single command
1 | city_palette(name, number, ...)
|
name |
character; the palette name (case sensitives) |
number |
character or integer; the palette number; this depends on |
... |
additional arguments to |
This function uses read_cpt
and cpt
.
A cpt.cols-class
object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
# Say we wanted to get a sequential palette of oranges to reds
Pal <- 'OrRd'
n <- 5
# The most direct way is:
p.a <- city_palette(Pal, n)
# careful, though, this isnt a vector
str(p.a)
# It can be coerced to one though:
as.character(p.a)
# or
as.vector(p.a)
# The 'long' way to get the palette:
p.b <- read_cpt(cpt(Pal, n))
# ... should yield the same result as the short way:
try(identical(p.a, p.b))
# Take a look:
layout(matrix(1:2))
plot(p.a)
plot(p.b)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.