Learn R Programming

thewitcher (version 1.0.1)

witcherMap: The Witcher Colour Map.

Description

This function creates a vector of n equally spaced colors along the 'witcher colour map'.

A simple function that returns a plot of all available palettes in the theWitcher - package

Usage

witcherMap(
  n = 256,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  option = "Geralt"
)

witcher(n, alpha = 1, begin = 0, end = 1, direction = 1, option = "Geralt")

witcher_pal(alpha = 1, begin = 0, end = 1, direction = 1, option = "Geralt")

witcher(n, alpha = 1, begin = 0, end = 1, direction = 1, option = "Geralt")

witcher_palette_names()

witcher_colors()

Arguments

n

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

alpha

The alpha transparency, a number in from 0 to 1, see argument alpha in hsv.

begin

The (corrected) hue in from 0 to 1 at which the witcher colormap begins.

end

The (corrected) hue in from 0 to 1 at which the witcher colormap 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 colourmap to use. It is not case-sensible

palettes

one or more palettes to show

Value

witcher returns a character vector, cv, of color hex codes. This can be used either to create a user-defined color palette for subsequent graphics by palette(cv), a col = specification in graphics functions or in par.

witcherMap returns a n lines data frame containing the red (R), green (G), blue (B) and alpha (alpha) channels of n equally spaced colors along the 'The Witcher' colour map. n = 256 by default.

Examples

Run this code
# NOT RUN {


pal <- witcher(255, option = "Geralt")
image(volcano, col = pal)

library(ggplot2)

ggplot(data.frame(x = rnorm(10000), y = rnorm(10000)), aes(x = x, y = y)) +
geom_hex() + coord_fixed() +
scale_fill_witcher(option="school_griffin") + theme_bw()

# }

Run the code above in your browser using DataLab