tanagr_palette: Chooses palette to use with base R.

Description Usage Arguments Examples

View source: R/choose_palette_br.R

Description

It generates a discrete palette with the number of colors available in the palette. If discrete = FALSE, a continuous palette is generated by linear interpolation (1:n) of the colors available in the palette.

Usage

1
tanagr_palette(palette_name, n, discrete = TRUE)

Arguments

palette_name

the name of the palette

n

number of colors requested (discrete). Number of colors for interpolation (continuous).

discrete

whether to use a discrete or continuous color palette (boolean)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
pal = tanagr_palette("bangsia_edwardsi")
data(iris)
plot(iris$Sepal.Width,
     iris$Sepal.Length,
     col = pal[as.numeric(iris$Species)],
     pch = 19,
     cex = 2)

pal = tanagr_palette("dacnis_berlepschi", n = 20, discrete = FALSE)
data(volcano)
image(volcano,
      col = pal,
      main = "Colors: Dacnis berlepschi")
#Change length of interpolation vector
pal = tanagr_palette("dacnis_berlepschi", n = 100, discrete = FALSE)
image(volcano,
      col = pal,
      main = "Colors: Dacnis berlepschi")

cdanielcadena/tanagR documentation built on Aug. 22, 2020, 3:23 a.m.