Package 'poisonfrogs'

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

Help Index


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 poison_palettes_names()).

n

Integer (optional). Number of colours to use. Defaults to the palette length (max. n = 5) for type = "discrete" and 256 for type = "continuous".

type

Either "discrete" or "continuous".

direction

Integer. 1 for forward, -1 for reversed order.

alpha

Optional numeric in ⁠[0, 1]⁠. Uniform transparency applied to all colours.

return

Either "plot" (default) to show a tile plot with hex labels, or "vector" to return a character vector of hex colours.

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)

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()

Colour Palettes of Neotropical Poison Frogs

Description

logo

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 [email protected]

Authors:

See Also

Useful links:


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 poison_palette_names().

type

Either "discrete" or "continuous". Selects which kind of ggplot2 scale is constructed.

direction

Integer. 1 for the palette in its stored order, -1 to reverse it.

alpha

Optional numeric in ⁠[0, 1]⁠. Applies a uniform transparency to all colors (both discrete and continuous modes).

...

Additional arguments passed to the underlying ggplot2 scale.

Details

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)
 )