| Title: | Color Palettes Inspired by Neotropical Poison Frogs |
|---|---|
| Description: | A collection of color palettes inspired by the enormous diversity of skin colors in Neotropical poison frog species. Suitable for use with 'ggplot2' and base R graphics. |
| Authors: | Camilo Rodríguez [aut, cre], Lauren O'Connell [aut] |
| Maintainer: | Camilo Rodríguez <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.2.9000 |
| Built: | 2026-05-25 06:49:59 UTC |
| Source: | https://github.com/laurenoconnelllab/poisonfrogs |
Visualize colors and print hexcodes from a poison frog color palette.
poison_palette( name, n = NULL, type = c("discrete", "continuous"), direction = 1, alpha = NULL, return = c("plot", "vector") )poison_palette( name, n = NULL, type = c("discrete", "continuous"), direction = 1, alpha = NULL, return = c("plot", "vector") )
name |
Character. Name of poison frog palette (one of |
n |
Integer (optional). Number of colours to use. Defaults to the
palette length (max. n = 5) for |
type |
Either |
direction |
Integer. |
alpha |
Optional numeric in |
return |
Either |
If return = "plot", a ggplot2 object. If return = "vector",
a character vector of hex colours.
# Show a palette as tiles (default) poison_palette("Ramazonica") # Reverse order and show only 4 colours poison_palette("Ramazonica", n = 4, direction = -1) # Get a vector with the palette hex codes cols <- poison_palette("Ramazonica", return = "vector") # Continuous gradient preview (16 swatches) poison_palette("Osotokiki", type = "continuous", n = 16)# Show a palette as tiles (default) poison_palette("Ramazonica") # Reverse order and show only 4 colours poison_palette("Ramazonica", n = 4, direction = -1) # Get a vector with the palette hex codes cols <- poison_palette("Ramazonica", return = "vector") # Continuous gradient preview (16 swatches) poison_palette("Osotokiki", type = "continuous", n = 16)
List the names of available color palettes inspired in poison frogs and other frog species.
poison_palettes_names()poison_palettes_names()
A character vector of palette names.
poison_palettes_names()poison_palettes_names()
A collection of color palettes inspired by the enormous diversity of skin colors in Neotropical poison frog species. Suitable for use with 'ggplot2' and base R graphics.
Maintainer: Camilo Rodríguez [email protected]
Authors:
Lauren O'Connell [email protected]
Useful links:
Report bugs at https://github.com/laurenoconnelllab/poisonfrogs/issues
The poison scales provide color maps inspired by the diverse colors
of Neotropical poison frogs. For discrete data it uses
ggplot2::discrete_scale(), and for continuous data it builds a smooth
gradient with ggplot2::scale_color_gradientn().
scale_color_poison( name, type = c("discrete", "continuous"), direction = 1, alpha = NULL, ... ) scale_colour_poison( name, type = c("discrete", "continuous"), direction = 1, alpha = NULL, ... ) scale_fill_poison( name, type = c("discrete", "continuous"), direction = 1, alpha = NULL, ... )scale_color_poison( name, type = c("discrete", "continuous"), direction = 1, alpha = NULL, ... ) scale_colour_poison( name, type = c("discrete", "continuous"), direction = 1, alpha = NULL, ... ) scale_fill_poison( name, type = c("discrete", "continuous"), direction = 1, alpha = NULL, ... )
name |
Character. Name of the poison frog palette to use
one of |
type |
Either |
direction |
Integer. |
alpha |
Optional numeric in |
... |
Additional arguments passed to the underlying ggplot2 scale. |
Discrete: relies on an internal function factory poison_pal() that
returns n colors (max. n = 5) on demand for ggplot2::discrete_scale().
Continuous: generates a 256-color gradient via poison_palette()
(type "continuous") and passes it to ggplot2::scale_color_gradientn().
A ggplot2 scale object.
poison_palette(), poison_pal()
require(ggplot2) require(gapminder) require(ggridges) require(tibble) require(scales) # Using `scale_color_poison()` with discrete scale ggplot(gapminder, aes(x = lifeExp, y = log(gdpPercap), colour = continent)) + geom_point(alpha = 0.2) + scale_color_poison(name = "Ramazonica", type = "discrete") + stat_smooth() + facet_wrap(. ~ continent, scales = "free") + theme_minimal(21, base_line_size = 0.2) + theme( legend.position = "none", strip.background = element_blank(), strip.placement = "outside" ) # Using `scale_color_poison()` with continuous scale ggplot(mtcars, aes(wt, mpg, colour = disp)) + geom_point(size = 3) + scale_color_poison("Ramazonica", type = "continuous", direction = -1) + stat_smooth(col = "black") + theme_classic(base_size = 32, base_line_size = 0.5) # Using `scale_fill_poison()` with discrete scale ggplot(gapminder, aes(x = continent, y = lifeExp, fill = continent)) + geom_violin(trim = FALSE, alpha = 0.75) + geom_jitter( shape = 21, position = position_jitter(0.1), alpha = 0.3, size = 0.8, bg = "grey" ) + stat_summary( fun = mean, geom = "point", size = 1.5, color = "black", alpha = 0.6 ) + theme_classic(base_size = 32, base_line_size = 0.5) + scale_fill_poison( name = "Ramazonica", type = "discrete", alpha = 0.95, direction = -1 ) + theme(legend.position = "none") + xlab(NULL) df_nottem <- tibble(year = floor(time(nottem)), month = factor(month.abb[cycle(nottem)], levels = month.abb), temp = as.numeric(nottem)) # Using `scale_fill_poison()` with continuous scale ggplot(df_nottem, aes(x = temp, y = month, fill = stat(x))) + geom_density_ridges_gradient(scale = 2, rel_min_height = 0.01) + scale_fill_poison( name = "Ramazonica", type = "continuous", alpha = 0.95, direction = 1 ) + labs( fill = "ºF") + theme_light(base_size = 26, base_line_size = 0.5) + theme( legend.position = "right", legend.justification = "left", legend.margin = margin(0,0,0,0), legend.box.margin = margin(-20,-20,-20,-20) )require(ggplot2) require(gapminder) require(ggridges) require(tibble) require(scales) # Using `scale_color_poison()` with discrete scale ggplot(gapminder, aes(x = lifeExp, y = log(gdpPercap), colour = continent)) + geom_point(alpha = 0.2) + scale_color_poison(name = "Ramazonica", type = "discrete") + stat_smooth() + facet_wrap(. ~ continent, scales = "free") + theme_minimal(21, base_line_size = 0.2) + theme( legend.position = "none", strip.background = element_blank(), strip.placement = "outside" ) # Using `scale_color_poison()` with continuous scale ggplot(mtcars, aes(wt, mpg, colour = disp)) + geom_point(size = 3) + scale_color_poison("Ramazonica", type = "continuous", direction = -1) + stat_smooth(col = "black") + theme_classic(base_size = 32, base_line_size = 0.5) # Using `scale_fill_poison()` with discrete scale ggplot(gapminder, aes(x = continent, y = lifeExp, fill = continent)) + geom_violin(trim = FALSE, alpha = 0.75) + geom_jitter( shape = 21, position = position_jitter(0.1), alpha = 0.3, size = 0.8, bg = "grey" ) + stat_summary( fun = mean, geom = "point", size = 1.5, color = "black", alpha = 0.6 ) + theme_classic(base_size = 32, base_line_size = 0.5) + scale_fill_poison( name = "Ramazonica", type = "discrete", alpha = 0.95, direction = -1 ) + theme(legend.position = "none") + xlab(NULL) df_nottem <- tibble(year = floor(time(nottem)), month = factor(month.abb[cycle(nottem)], levels = month.abb), temp = as.numeric(nottem)) # Using `scale_fill_poison()` with continuous scale ggplot(df_nottem, aes(x = temp, y = month, fill = stat(x))) + geom_density_ridges_gradient(scale = 2, rel_min_height = 0.01) + scale_fill_poison( name = "Ramazonica", type = "continuous", alpha = 0.95, direction = 1 ) + labs( fill = "ºF") + theme_light(base_size = 26, base_line_size = 0.5) + theme( legend.position = "right", legend.justification = "left", legend.margin = margin(0,0,0,0), legend.box.margin = margin(-20,-20,-20,-20) )