Title: | Colorblind-Friendly Palettes from Washington State |
---|---|
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. |
Authors: | Cory McCartan [aut, cre] |
Maintainer: | Cory McCartan <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.1 |
Built: | 2024-11-24 02:53:38 UTC |
Source: | https://github.com/CoryMcCartan/wacolors |
ggplot2
scaleCall 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.
pal_functions( palette, which = NULL, type = c("discrete", "continuous"), reverse = FALSE )
pal_functions( palette, which = NULL, type = c("discrete", "continuous"), reverse = FALSE )
palette |
a |
which |
if not |
type |
Either |
reverse |
|
The generated code, invisibly, as a character vector.
pal_functions("rainier")
pal_functions("rainier")
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.
pal_vector( palette, n, which = NULL, type = c("discrete", "continuous"), reverse = FALSE )
pal_vector( palette, n, which = NULL, type = c("discrete", "continuous"), reverse = FALSE )
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 |
|
The generated code, invisibly, as a character vector.
pal_vector("rainier", 4)
pal_vector("rainier", 4)
ggplot2
Color palettes for ggplot2
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)
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)
palette |
a |
which |
if not |
... |
Other arguments passed on to |
reverse |
|
midpoint |
if not |
A ggplot2::Scale object.
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)
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)
Generate palette
objects from the wacolors
list
wa_pal( palette, n, which = NULL, type = c("discrete", "continuous"), reverse = FALSE )
wa_pal( palette, n, which = NULL, type = c("discrete", "continuous"), reverse = FALSE )
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 |
|
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.
wa_pal("rainier") wa_pal(wacolors$rainier) wa_pal("sound_sunset", 20, "continuous") wa_pal("washington_pass", reverse=TRUE)
wa_pal("rainier") wa_pal(wacolors$rainier) wa_pal("sound_sunset", 20, "continuous") wa_pal("washington_pass", reverse=TRUE)
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.
wacolors
wacolors
A list of character vectors containing the color palettes. Discrete palette vectors contain names for each color.
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:
wacolors$rainier wacolors$palouse[1:4]
wacolors$rainier wacolors$palouse[1:4]