city_palette: Convenience function to quickly get a color palette

Description Usage Arguments Details Value See Also Examples

Description

Return a color palette which can be used for plotting, with a single command

Usage

1
city_palette(name, number, ...)

Arguments

name

character; the palette name (case sensitives)

number

character or integer; the palette number; this depends on name

...

additional arguments to read_cpt

Details

This function uses read_cpt and cpt.

Value

A cpt.cols-class object

See Also

read_cpt

Examples

 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)

abarbour/cb.city documentation built on May 10, 2019, 4:06 a.m.