| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/scale_divergingx.R |
| 3 |
\name{scale_colour_discrete_divergingx} |
| 4 |
\alias{scale_colour_discrete_divergingx} |
| 5 |
\alias{scale_color_discrete_divergingx} |
| 6 |
\alias{scale_fill_discrete_divergingx} |
| 7 |
\title{HCL-Based Discrete Flexible Diverging Scales for ggplot2} |
| 8 |
\usage{ |
| 9 |
scale_colour_discrete_divergingx( |
| 10 |
palette = "Geyser", |
| 11 |
c1 = NULL, |
| 12 |
c2 = NULL, |
| 13 |
c3 = NULL, |
| 14 |
l1 = NULL, |
| 15 |
l2 = NULL, |
| 16 |
l3 = NULL, |
| 17 |
h1 = NULL, |
| 18 |
h2 = NULL, |
| 19 |
h3 = NULL, |
| 20 |
p1 = NULL, |
| 21 |
p2 = NULL, |
| 22 |
p3 = NULL, |
| 23 |
p4 = NULL, |
| 24 |
cmax1 = NULL, |
| 25 |
cmax2 = NULL, |
| 26 |
alpha = 1, |
| 27 |
rev = FALSE, |
| 28 |
nmax = NULL, |
| 29 |
order = NULL, |
| 30 |
aesthetics = "colour", |
| 31 |
... |
| 32 |
) |
| 33 |
|
| 34 |
scale_color_discrete_divergingx( |
| 35 |
palette = "Geyser", |
| 36 |
c1 = NULL, |
| 37 |
c2 = NULL, |
| 38 |
c3 = NULL, |
| 39 |
l1 = NULL, |
| 40 |
l2 = NULL, |
| 41 |
l3 = NULL, |
| 42 |
h1 = NULL, |
| 43 |
h2 = NULL, |
| 44 |
h3 = NULL, |
| 45 |
p1 = NULL, |
| 46 |
p2 = NULL, |
| 47 |
p3 = NULL, |
| 48 |
p4 = NULL, |
| 49 |
cmax1 = NULL, |
| 50 |
cmax2 = NULL, |
| 51 |
alpha = 1, |
| 52 |
rev = FALSE, |
| 53 |
nmax = NULL, |
| 54 |
order = NULL, |
| 55 |
aesthetics = "colour", |
| 56 |
... |
| 57 |
) |
| 58 |
|
| 59 |
scale_fill_discrete_divergingx(..., aesthetics = "fill") |
| 60 |
} |
| 61 |
\arguments{ |
| 62 |
\item{palette}{The name of the palette to be used.} |
| 63 |
|
| 64 |
\item{h1, h2, h3, c1, c2, c3, l1, l2, l3, p1, p2, p3, p4, cmax1, cmax2}{Parameters to customize the scale. See \code{\link{divergingx_hcl}} for details.} |
| 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{divergingx_hcl}}. |
| 82 |
} |
| 83 |
\details{ |
| 84 |
Available CARTO palettes: ArmyRose, Earth, Fall, Geyser, TealRose, Temps, Tropic. |
| 85 |
|
| 86 |
Available ColorBrewer.org palettes: Spectral, PuOr, RdYlGn, RdYlBu, RdGy, |
| 87 |
BrBG, PiYG, PRGn, RdBu. |
| 88 |
|
| 89 |
If both a valid palette name and palette parameters are provided then the provided palette parameters overwrite the parameters in the |
| 90 |
named palette. This enables easy customization of named palettes. |
| 91 |
} |
| 92 |
\examples{ |
| 93 |
library("ggplot2") |
| 94 |
|
| 95 |
# default color scale |
| 96 |
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + |
| 97 |
geom_point() + theme_minimal() + |
| 98 |
scale_color_discrete_divergingx() |
| 99 |
|
| 100 |
# color scale "Tropic" |
| 101 |
ggplot(iris, aes(Sepal.Length, fill = Species)) + |
| 102 |
geom_density(alpha = 0.7) + theme_classic() + |
| 103 |
scale_fill_discrete_divergingx(palette = "Tropic", rev = TRUE) |
| 104 |
|
| 105 |
# use `nmax` and `order` to skip some colors |
| 106 |
ggplot(iris, aes(Sepal.Length, fill = Species)) + |
| 107 |
geom_density(alpha = 0.7) + theme_classic() + |
| 108 |
scale_fill_discrete_divergingx(palette = "Tropic", nmax = 5, order = c(1, 4, 5)) |
| 109 |
} |