create.palette: Create a palette given multiple words

Description Usage Arguments Value See Also Examples

View source: R/functions.R

Description

Create a palette given multiple words

Usage

1
2
create.palette(sentence, n.colors = NULL, sorted = TRUE,
  aggreg.method = "most-prominent", language = "en")

Arguments

sentence

a string of words

n.colors

number of colors of the palette. If NULL (default) then n.colors is set to the number of words in the sentenceargument

sorted

logical, if TRUE then colors are sorted according to their hue.

aggreg.method

method of aggregation of the colors corresponding to each word in the sentence argument. Possible choices are:

  • most-prominent: take the first value returned by the function get.color;

  • median: sort all the colors returned by the function get.color according to their hue and then take the median color;

  • mean: take the mean of all the colors returned by the function get.color in the hsv space.

language

string defining the language of sentence (defaults to english).

Value

a color palette of n.colors elements.

See Also

get.color

Examples

1
2
3
4
5
mfl = "the rain in spain stays mainly in the plain"
mfl1 = create.palette(mfl, n.colors = 11)
mfl2 = create.palette(mfl, n.colors = 11, aggreg.method = "median")
plot(1:11, rep(0, 11), pch = 15, col = mfl1, cex = 4, axes = FALSE, xlab = "", ylab = "")
points(1:11, rep(-0.2, 11), pch = 15, col = mfl1, cex = 4)

tulliapadellini/rainbaud documentation built on July 12, 2019, 9:55 p.m.