Title: | Colorblind-Friendly Palettes from Washington State |
Version: | 0.3.1 |
Description: | Color palettes taken from the landscapes and cities of Washington state. Colors were extracted from a set of photographs, and then combined to form a set of continuous and discrete palettes. Continuous palettes were designed to be perceptually uniform, while discrete palettes were chosen to maximize contrast at several different levels of overall brightness and saturation. Each palette has been evaluated to ensure colors are distinguishable by colorblind people. |
Depends: | R (≥ 3.0) |
Imports: | graphics, grDevices, ggplot2, scales |
Suggests: | cli, rstudioapi, colorspace, viridis, knitr, rmarkdown, testthat (≥ 3.0.0) |
License: | MIT + file LICENSE |
URL: | https://github.com/CoryMcCartan/wacolors |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.2 |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2022-03-01 15:33:19 UTC; cmccartan |
Author: | Cory McCartan [aut, cre] |
Maintainer: | Cory McCartan <cmccartan@g.harvard.edu> |
Repository: | CRAN |
Date/Publication: | 2022-03-01 15:50:02 UTC |
Output a character vector containing code for a ggplot2
scale
Description
Call this function to get the code for the scale_*
functions for a palette.
If using RStudio, the code will be loaded at the console prompt;
otherwise, it will be printed at the terminal. Assumes that ggplot2
has
been loaded into the namespace, or will be by the time the scales are used.
Usage
pal_functions(
palette,
which = NULL,
type = c("discrete", "continuous"),
reverse = FALSE
)
Arguments
palette |
a |
which |
if not |
type |
Either |
reverse |
|
Value
The generated code, invisibly, as a character vector.
Examples
pal_functions("rainier")
Output a character vector containing code for a palette
Description
Call this function to get the code for a character vector containing a palette. If using RStudio, the code will be loaded at the console prompt; otherwise, it will be printed at the terminal.
Usage
pal_vector(
palette,
n,
which = NULL,
type = c("discrete", "continuous"),
reverse = FALSE
)
Arguments
palette |
The name of the palette (partial matching supported), or an
actual palette from |
n |
The number of colors in the palette. If this exceeds the actual
number and |
which |
if not |
type |
Either |
reverse |
|
Value
The generated code, invisibly, as a character vector.
Examples
pal_vector("rainier", 4)
Color palettes for ggplot2
Description
Color palettes for ggplot2
Usage
scale_color_wa_d(palette = "rainier", which = NULL, ..., reverse = FALSE)
scale_fill_wa_d(palette = "rainier", which = NULL, ..., reverse = FALSE)
scale_color_wa_c(
palette = "sound_sunset",
which = NULL,
midpoint = NULL,
...,
reverse = FALSE
)
scale_fill_wa_c(
palette = "sound_sunset",
which = NULL,
midpoint = NULL,
...,
reverse = FALSE
)
scale_color_wa_b(palette = "sound_sunset", which = NULL, ..., reverse = FALSE)
scale_fill_wa_b(palette = "sound_sunset", which = NULL, ..., reverse = FALSE)
scale_colour_wa_d(palette = "rainier", which = NULL, ..., reverse = FALSE)
scale_colour_wa_c(
palette = "sound_sunset",
which = NULL,
midpoint = NULL,
...,
reverse = FALSE
)
scale_colour_wa_b(palette = "sound_sunset", which = NULL, ..., reverse = FALSE)
Arguments
palette |
a |
which |
if not |
... |
Other arguments passed on to |
reverse |
|
midpoint |
if not |
Value
A ggplot2::Scale object.
Examples
library(ggplot2)
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(color = factor(cyl), size=hp)) +
scale_color_wa_d()
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(color = hp)) +
scale_color_wa_c("palouse", which=c("snake", "wheat"))
ggplot(diamonds) +
geom_bar(aes(x = cut, fill = clarity)) +
scale_fill_wa_d(wacolors$sound_sunset, reverse=TRUE)
Washington State Color Palette Generator
Description
Generate palette
objects from the wacolors
list
Usage
wa_pal(
palette,
n,
which = NULL,
type = c("discrete", "continuous"),
reverse = FALSE
)
Arguments
palette |
The name of the palette (partial matching supported), or an
actual palette from |
n |
The number of colors in the palette. If this exceeds the actual
number and |
which |
if not |
type |
Either |
reverse |
|
Value
A vector of colors of type palette
. Use the plot()
function to
plot the palette. If the cli
package is installed, printing the palette
to the console will also show its colors.
Examples
wa_pal("rainier")
wa_pal(wacolors$rainier)
wa_pal("sound_sunset", 20, "continuous")
wa_pal("washington_pass", reverse=TRUE)
Washington State Color Palettes
Description
A collection of colorblind-friendly color palettes for various settings in the state of Washington. Colors were extracted from a set of photographs, and then combined to form a set of continuous and discrete palettes. Continuous palettes were designed to be perceptually uniform, while discrete palettes were chosen to maximize contrast at several different levels of overall brightness and saturation. Each palette has been evaluated to ensure colors are distinguishable by colorblind people.
Usage
wacolors
Format
A list of character vectors containing the color palettes. Discrete palette vectors contain names for each color.
Details
Discrete palettes contain at most seven colors. Don't create graphics that use more than seven discrete colors. You can color a map with four. Anything more risks confusion. Consider differentiating through faceting or labels, instead.
Available continuous palettes:
Available discrete palettes:
Examples
wacolors$rainier
wacolors$palouse[1:4]