| Title: | Color Palettes Inspired by Neotropical Poison Frogs |
| Version: | 1.0.2 |
| 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. |
| URL: | https://laurenoconnelllab.github.io/poisonfrogs/ |
| BugReports: | https://github.com/laurenoconnelllab/poisonfrogs/issues |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Depends: | R (≥ 2.10) |
| Imports: | ggplot2 (≥ 3.4.0), lifecycle, rlang |
| Suggests: | testthat (≥ 3.0.0), gapminder, ggridges, scales, tibble |
| Config/testthat/edition: | 3 |
| Config/Needs/website: | rmarkdown |
| NeedsCompilation: | no |
| Packaged: | 2025-11-20 16:33:13 UTC; camilorodriguezlopez |
| Author: | Camilo Rodríguez [aut, cre], Lauren O'Connell [aut] |
| Maintainer: | Camilo Rodríguez <camo.rodriguez@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-11-24 18:30:02 UTC |
Colour Palettes of 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.
Author(s)
Maintainer: Camilo Rodríguez camo.rodriguez@gmail.com
Authors:
Lauren O'Connell loconnel@stanford.edu
See Also
Useful links:
Report bugs at https://github.com/laurenoconnelllab/poisonfrogs/issues
Plot and print poison frog color palettes.
Description
Visualize colors and print hexcodes from a poison frog color palette.
Usage
poison_palette(
name,
n = NULL,
type = c("discrete", "continuous"),
direction = 1,
alpha = NULL,
return = c("plot", "vector")
)
Arguments
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 |
Value
If return = "plot", a ggplot2 object. If return = "vector",
a character vector of hex colours.
Examples
# 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)
Poison frog palettes
Description
Poison frog palettes
Usage
poison_palettes
Format
An object of class list of length 41.
List the names of available color palettes inspired in poison frogs and other frog species.
Description
List the names of available color palettes inspired in poison frogs and other frog species.
Usage
poison_palettes_names()
Value
A character vector of palette names.
Examples
poison_palettes_names()
Poison frog color scales for ggplot2
Description
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().
Usage
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,
...
)
Arguments
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. |
Details
-
Discrete: relies on an internal function factory
poison_pal()that returnsncolors (max. n = 5) on demand forggplot2::discrete_scale(). -
Continuous: generates a 256-color gradient via
poison_palette()(type"continuous") and passes it toggplot2::scale_color_gradientn().
Value
A ggplot2 scale object.
See Also
poison_palette(), poison_pal()
Examples
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)
)