Debian Codegraph @

man/scale_colour_discrete_diverging.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/scale_diverging.R
3 \name{scale_colour_discrete_diverging}
4 \alias{scale_colour_discrete_diverging}
5 \alias{scale_color_discrete_diverging}
6 \alias{scale_fill_discrete_diverging}
7 \title{HCL-Based Discrete Diverging Color Scales for ggplot2}
8 \usage{
9 scale_colour_discrete_diverging(
10 palette = NULL,
11 c1 = NULL,
12 cmax = NULL,
13 l1 = NULL,
14 l2 = NULL,
15 h1 = NULL,
16 h2 = NULL,
17 p1 = NULL,
18 p2 = NULL,
19 alpha = 1,
20 rev = FALSE,
21 nmax = NULL,
22 order = NULL,
23 aesthetics = "colour",
24 ...
25 )
26
27 scale_color_discrete_diverging(
28 palette = NULL,
29 c1 = NULL,
30 cmax = NULL,
31 l1 = NULL,
32 l2 = NULL,
33 h1 = NULL,
34 h2 = NULL,
35 p1 = NULL,
36 p2 = NULL,
37 alpha = 1,
38 rev = FALSE,
39 nmax = NULL,
40 order = NULL,
41 aesthetics = "colour",
42 ...
43 )
44
45 scale_fill_discrete_diverging(..., aesthetics = "fill")
46 }
47 \arguments{
48 \item{palette}{The name of the palette to be used. Run \code{hcl_palettes(type = "diverging")} for available options.}
49
50 \item{c1}{Chroma value at the scale endpoints.}
51
52 \item{cmax}{Maximum chroma value.}
53
54 \item{l1}{Luminance value at the scale endpoints.}
55
56 \item{l2}{Luminance value at the scale midpoint.}
57
58 \item{h1}{Hue value at the first endpoint.}
59
60 \item{h2}{Hue value at the second endpoint.}
61
62 \item{p1}{Control parameter determining how chroma should vary (1 = linear, 2 = quadratic, etc.).}
63
64 \item{p2}{Control parameter determining how luminance should vary (1 = linear, 2 = quadratic, etc.).}
65
66 \item{alpha}{Numeric vector of values in the range \code{[0, 1]} for alpha transparency channel (0 means transparent and 1 means opaque).}
67
68 \item{rev}{If \code{TRUE}, reverses the order of the colors in the color scale.}
69
70 \item{nmax}{Maximum number of different colors the palette should contain. If not provided, is calculated automatically
71 from the data.}
72
73 \item{order}{Numeric vector listing the order in which the colors should be used. Default is \code{1:nmax}.}
74
75 \item{aesthetics}{The ggplot2 aesthetics to which this scale should be applied.}
76
77 \item{...}{common discrete scale parameters: \code{name}, \code{breaks}, \code{labels}, \code{na.value}, \code{limits} and \code{guide}. See
78 \code{\link[ggplot2]{discrete_scale}} for more details.}
79 }
80 \description{
81 Discrete ggplot2 color scales using the color palettes generated by \code{\link{diverging_hcl}}.
82 }
83 \details{
84 If both a valid palette name and palette parameters are provided then the provided palette parameters overwrite the parameters in the
85 named palette. This enables easy customization of named palettes.
86 }
87 \examples{
88 library("ggplot2")
89
90 # default colors with slightly darkened midpoint
91 ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
92 geom_point() + theme_minimal() +
93 scale_color_discrete_diverging(l2=75)
94
95 # color scale "Green-Orange"
96 ggplot(iris, aes(Sepal.Length, fill = Species)) +
97 geom_density(alpha = 0.7) + theme_classic() +
98 scale_fill_discrete_diverging(palette = "Green-Orange", rev = TRUE)
99
100 # use `nmax` and `order` to skip some colors
101 ggplot(iris, aes(Sepal.Length, fill = Species)) +
102 geom_density(alpha = 0.7) + theme_classic() +
103 scale_fill_discrete_diverging(palette = "Green-Orange", nmax = 5, order = c(1, 4, 5))
104 }