| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/scale_qualitative.R |
| 3 |
\name{scale_colour_continuous_qualitative} |
| 4 |
\alias{scale_colour_continuous_qualitative} |
| 5 |
\alias{scale_color_continuous_qualitative} |
| 6 |
\alias{scale_fill_continuous_qualitative} |
| 7 |
\title{HCL-Based Continuous Qualitative Color Scales for ggplot2} |
| 8 |
\usage{ |
| 9 |
scale_colour_continuous_qualitative( |
| 10 |
palette = NULL, |
| 11 |
c1 = NULL, |
| 12 |
l1 = NULL, |
| 13 |
h1 = NULL, |
| 14 |
h2 = NULL, |
| 15 |
alpha = 1, |
| 16 |
rev = FALSE, |
| 17 |
begin = 0, |
| 18 |
end = 1, |
| 19 |
na.value = "grey50", |
| 20 |
guide = "colourbar", |
| 21 |
aesthetics = "colour", |
| 22 |
n_interp = 11, |
| 23 |
... |
| 24 |
) |
| 25 |
|
| 26 |
scale_color_continuous_qualitative( |
| 27 |
palette = NULL, |
| 28 |
c1 = NULL, |
| 29 |
l1 = NULL, |
| 30 |
h1 = NULL, |
| 31 |
h2 = NULL, |
| 32 |
alpha = 1, |
| 33 |
rev = FALSE, |
| 34 |
begin = 0, |
| 35 |
end = 1, |
| 36 |
na.value = "grey50", |
| 37 |
guide = "colourbar", |
| 38 |
aesthetics = "colour", |
| 39 |
n_interp = 11, |
| 40 |
... |
| 41 |
) |
| 42 |
|
| 43 |
scale_fill_continuous_qualitative(..., aesthetics = "fill") |
| 44 |
} |
| 45 |
\arguments{ |
| 46 |
\item{palette}{The name of the palette to be used. Run \code{hcl_palettes(type = "qualitative")} for available options.} |
| 47 |
|
| 48 |
\item{c1}{Chroma value, used for all colors in the scale.} |
| 49 |
|
| 50 |
\item{l1}{Luminance value, used for all colors in the scale.} |
| 51 |
|
| 52 |
\item{h1}{Beginning hue value.} |
| 53 |
|
| 54 |
\item{h2}{Ending hue value.} |
| 55 |
|
| 56 |
\item{alpha}{Numeric vector of values in the range \code{[0, 1]} for alpha transparency channel (0 means transparent and 1 means opaque).} |
| 57 |
|
| 58 |
\item{rev}{If \code{TRUE}, reverses the order of the colors in the color scale.} |
| 59 |
|
| 60 |
\item{begin}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the smallest data value should be mapped.} |
| 61 |
|
| 62 |
\item{end}{Number in the range of \code{[0, 1]} indicating to which point in the color scale the largest data value should be mapped.} |
| 63 |
|
| 64 |
\item{na.value}{Color to be used for missing data points.} |
| 65 |
|
| 66 |
\item{guide}{Type of legend. Use \code{"colourbar"} for continuous color bar.} |
| 67 |
|
| 68 |
\item{aesthetics}{The ggplot2 aesthetics to which this scale should be applied.} |
| 69 |
|
| 70 |
\item{n_interp}{Number of discrete colors that should be used to interpolate the continuous color scale. 11 will work fine in most cases.} |
| 71 |
|
| 72 |
\item{...}{common continuous scale parameters: `name`, `breaks`, `labels`, and `limits`. See |
| 73 |
\code{\link[ggplot2]{continuous_scale}} for more details.} |
| 74 |
} |
| 75 |
\description{ |
| 76 |
Continuous ggplot2 color scales using the color palettes generated by \code{\link{qualitative_hcl}}. These scales are provided |
| 77 |
for completeness. It is not normally a good idea to color a continuous variable using a qualitative scale. |
| 78 |
} |
| 79 |
\details{ |
| 80 |
If both a valid palette name and palette parameters are provided then the provided palette parameters overwrite the parameters in the |
| 81 |
named palette. This enables easy customization of named palettes. |
| 82 |
} |
| 83 |
\examples{ |
| 84 |
library("ggplot2") |
| 85 |
|
| 86 |
# none of these examples are necessarily good ideas |
| 87 |
gg <- ggplot(iris, aes(x = Species, y = Sepal.Width, color = Sepal.Length)) + |
| 88 |
geom_jitter(width = 0.3) + theme_minimal() |
| 89 |
|
| 90 |
gg + scale_color_continuous_qualitative(palette = "Warm") |
| 91 |
gg + scale_color_continuous_qualitative(palette = "Cold", l1 = 60) |
| 92 |
gg + scale_color_continuous_qualitative(palette = "Harmonic", rev = TRUE) |
| 93 |
|
| 94 |
nx = 87 |
| 95 |
ny = 61 |
| 96 |
df <- data.frame(height = c(volcano), x = rep(1:nx, ny), y = rep(1:ny, each = nx)) |
| 97 |
ggplot(df, aes(x, y, fill=height)) + |
| 98 |
geom_raster() + scale_fill_continuous_qualitative(palette = "Dark 3") + |
| 99 |
coord_fixed(expand = FALSE) |
| 100 |
} |