[dfe06d]: / R / palettes.R

Download this file

42 lines (36 with data), 1.1 kB

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
#' Color palettes used in outbreaker
#'
#' These functions are different color palettes (color-generating functions)
#' used in outbreaker.
#'
#' @rdname palettes
#'
#' @aliases outbreaker_palettes chains_pal
#'
#' @author Thibaut Jombart (\email{thibautjombart@@gmail.com})
#'
#' @param n a number of colors to be created
#'
#' @export
#'
#' @importFrom grDevices colorRampPalette
#'
#' @examples
#' plot(1:8, col = chains_pal(8), cex = 10, pch = 20)
#'
chains_pal <- function(n) {
colorRampPalette(c("#660033", "#339966", "#cccc00", "#333399"))(n)
}
#' @rdname palettes
#' @export
#' @aliases cases_pal
cases_pal <- function(n) {
## This was the viridis palette
## cols <- c("#440154FF", "#482878FF", "#3E4A89FF", "#31688EFF",
## "#26828EFF", "#1F9E89FF", "#35B779FF", "#6DCD59FF",
## "#B4DE2CFF", "#FDE725FF")
## This one is taken from epicontacts
cols <- c("#ccddff", "#79d2a6", "#ffb3b3", "#a4a4c1","#ffcc00", "#ff9f80",
"#ccff99", "#df9fbf","#ffcc99", "#cdcdcd")
colorRampPalette(cols)(n)
}