cpt: Create a cpt object

Description Usage Arguments Details Value See Also Examples

Description

A 'cpt' object contains the information necessary to download the color palette from cpt-city using read_cpt.

Usage

1
2
3
cpt(name, number, check.url = TRUE)

.check_cpt_list(name, number, error = TRUE)

Arguments

name

character; the palette name (case sensitives)

number

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

check.url

logical; should the status of the url of the color palette be tested?

error

logical; If TRUE, an error is signalled; if FALSE, only a warning is given.

Details

Use list_cpt to see all available options for the name and number arguments

Setting check.url=TRUE can add a bit of time, since cpt-city servers have relatively long response times, but doing so can save time downstream.

Value

A cpt-class object

See Also

read_cpt to download the colors

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 

Pal <- 'OrRd' # Orange to red

# See what options there are
list_cpt(pal.name == Pal)

#lets get the length-five version
n <- 5
cpt(Pal, n)

# Uses an internal check to make sure palettes do exist
try(cpt('OrangeRed', n)) # fails because the palette name is invalid
try(cpt(Pal, 999)) # fails because there isn't a variant of OrRd with that many colors

## End(Not run)

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