Processing math: 100%

This function creates a vector of colours along the selected colour map.

tintin_clrs(
  n = 5,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  option = "the_blue_lotus"
)

Arguments

n

The number of colors (1) to be in the palette.

alpha

The alpha transparency, a number in [0,1], see argument alpha in hsv.

begin

The (corrected) hue in [0,1] at which the color map begins.

end

The (corrected) hue in [0,1] at which the color map ends.

direction

Sets the order of colors in the scale. If 1, the default, colors are ordered from darkest to lightest. If -1, the order of colors is reversed.

option

A character string indicating the color map option to use. Options are available with tidy names (i.e., 'the_blue_lotus'):

"Tintin in the Land of the Soviets"
"Tintin in the Congo"
"Tintin in America"
"Cigars of the Pharaoh"
"The Blue Lotus" (Standard)
"The Broken Ear"
"The Black Island"
"King Ottokar's Sceptre"
"The Crab with the Golden Claws"
"The Shooting Star"
"The Secret of the Unicorn"
"Red Rackham's Treasure"
"The Seven Crystal Balls"
"Prisoners of the Sun"
"Land of Black Gold"
"Destination Moon"
"Explorers on the Moon"
"The Calculus Affair"
"The Red Sea Sharks"
"Tintin in Tibet"
"The Castafiore Emerald"
"Flight 714 to Sydney"
"Tintin and the Picaros"
"Tintin and Alph-Art"

Value

A character vector of colors.

Details

Check the README for the display of the color palettes. Semi-transparent colors (0<alpha<1) are supported only on some devices (see rgb).

Examples

# without extrapolation: 5 or fewer colors
n <- 5

tintin_clrs(n, option = "the_blue_lotus")
#> [1] "#e30013" "#1a9abd" "#8d512d" "#de9c62" "#30515a"

image(
  1:n, 1, as.matrix(1:n),
  col = tintin_clrs(n, option = "the_blue_lotus"),
  xlab = "Tintin darkblue n", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)


# with extrapolation: 6 or more colors
n <- 20
image(
  1:n, 1, as.matrix(1:n),
  col = tintin_clrs(n, option = "the_blue_lotus"),
  xlab = "Tintin darkblue n", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)