Debian Codegraph @

man/divergingx_hcl.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/divergingx_hcl.R
3 \name{divergingx_hcl}
4 \alias{divergingx_hcl}
5 \alias{divergex_hcl}
6 \alias{divergingx_palettes}
7 \title{(More) Flexible Diverging HCL Palettes}
8 \usage{
9 divergingx_hcl(
10 n,
11 palette = "Geyser",
12 ...,
13 fixup = TRUE,
14 alpha = 1,
15 rev = FALSE,
16 h1,
17 h2,
18 h3,
19 c1,
20 c2,
21 c3,
22 l1,
23 l2,
24 l3,
25 p1,
26 p2,
27 p3,
28 p4,
29 cmax1,
30 cmax2
31 )
32
33 divergingx_palettes(palette = NULL, plot = FALSE, n = 7L, ...)
34 }
35 \arguments{
36 \item{n}{the number of colors (\eqn{\ge 1}{>= 1}) to be in the palette.}
37
38 \item{palette}{character with the name (see details).}
39
40 \item{\dots}{arguments passed to \code{\link{hex}}.}
41
42 \item{fixup}{logical. Should the color be corrected to a valid RGB value?}
43
44 \item{alpha}{numeric vector of values in the range \code{[0, 1]} for alpha
45 transparency channel (0 means transparent and 1 means opaque).}
46
47 \item{rev}{logical. Should the palette be reversed?}
48
49 \item{h1}{numeric. Starting hue coordinate.}
50
51 \item{h2}{numeric. Center hue coordinate.}
52
53 \item{h3}{numeric. Ending hue coordinate.}
54
55 \item{c1}{numeric. Chroma coordinate corresponding to \code{h1}.}
56
57 \item{c2}{numeric. Chroma coordinate corresponding to \code{h2} (if \code{NA}, set to 0).}
58
59 \item{c3}{numeric. Chroma coordinate corresponding to \code{h3} (if \code{NA}, \code{c1} is used).}
60
61 \item{l1}{numeric. Luminance coordinate corresponding to \code{h1}.}
62
63 \item{l2}{numeric. Luminance coordinate corresponding to \code{h2} (if \code{NA}, \code{l1} is used).}
64
65 \item{l3}{numeric. Luminance coordinate corresponding to \code{h3} (if \code{NA}, \code{l1} is used).}
66
67 \item{p1}{numeric. Power parameter for chroma coordinates in first sequential palette (if \code{NA}, \code{1} is used).}
68
69 \item{p2}{numeric. Power parameter for luminance coordinates in first sequential palette (if \code{NA}, \code{p1} is used).}
70
71 \item{p3}{numeric. Power parameter for chroma coordinates in second sequential palette (if \code{NA}, \code{p1} is used).}
72
73 \item{p4}{numeric. Power parameter for luminance coordinates in second sequential palette (if \code{NA}, \code{p2} is used).}
74
75 \item{cmax1}{numeric. Maximum chroma coordinate in first sequential palette (not used if \code{NA}).}
76
77 \item{cmax2}{numeric. Maximum chroma coordinate in second sequential palette (not used if \code{NA}).}
78
79 \item{plot}{logical. Should the selected HCL color palettes be visualized?}
80 }
81 \value{
82 A character vector with (s)RGB codings of the colors in the palette.
83 }
84 \description{
85 Diverging HCL color palettes generated through combination of two fully
86 flexible (and possibly unbalanced) multi-hue sequential palettes.
87 }
88 \details{
89 The \code{divergingx_hcl} function simply calls \code{\link{sequential_hcl}}
90 twice with a prespecified set of hue, chroma, and luminance parameters. This is
91 similar to \code{\link{diverging_hcl}} but allows for more flexibility:
92 \code{diverging_hcl} employs two \emph{single-hue} sequential palettes,
93 always uses zero chroma for the neutral/central color, and restricts the
94 chroma/luminance path to be the same in both \dQuote{arms} of the palette.
95 In contrast, \code{divergingx_hcl} relaxes this to two full \emph{multi-hue}
96 palettes that can thus go through a non-gray neutral color (typically light
97 yellow). Consequently, the chroma/luminance paths can be rather unbalanced
98 between the two arms.
99
100 With this additional flexibility various diverging palettes suggested by
101 \url{https://ColorBrewer2.org/} and CARTO (\url{https://carto.com/carto-colors/}),
102 can be emulated along with the Zissou 1 palette from \pkg{wesanderson},
103 Cividis from \pkg{viridis}, and Roma from \pkg{scico}.
104
105 Available CARTO palettes: ArmyRose, Earth, Fall, Geyser, TealRose, Temps, and
106 Tropic (with Tropic also available in \code{diverging_hcl}).
107
108 Available ColorBrewer.org palettes: PuOr, RdBu, RdGy, PiYG, PRGn, BrBG, RdYlBu,
109 RdYlGn, Spectral.
110 }
111 \examples{
112 ## show emulated CARTO/ColorBrewer.org palettes
113 divergingx_palettes(plot = TRUE)
114
115 ## compared to diverging_hcl() the diverging CARTO palettes are typically warmer
116 ## but also less balanced with respect to chroma/luminance, see e.g.,
117 specplot(divergingx_hcl(7, "ArmyRose"))
118 }
119 \references{
120 Zeileis A, Fisher JC, Hornik K, Ihaka R, McWhite CD, Murrell P, Stauffer R, Wilke CO (2020).
121 \dQuote{colorspace: A Toolbox for Manipulating and Assessing Colors and Palettes.}
122 \emph{Journal of Statistical Software}, \bold{96}(1), 1--49. \doi{10.18637/jss.v096.i01}
123 }
124 \seealso{
125 \code{\link[colorspace]{sequential_hcl}}, \code{\link[colorspace]{diverging_hcl}}
126 }
127 \keyword{color}