random_swatch_colour: Random swatch colour

Description Usage Arguments Details Author(s) Examples

View source: R/random_swatch_colour.R

Description

Gives a random colour from ggthemr swatch. This might be useful if you are producing lots of plots with one colour, which can get a bit boring to look at. You can use this function to get a random colour for each of your plots to make them more interesting.

Usage

1

Arguments

limit

How many colours from the swatch should be considered for sampling (see details).

Details

The first colour of the swatch will never be returned as this is a special value. The first few colours are usually "better" as they are well suited to the theme and have good contrast with each other. The random colour is therefore limited by default to the first few colours.

Author(s)

Ciaran Tobin

Examples

1
2
3
4
5
6
7
ggthemr('dust')
ggplot(diamonds, aes(carat, price)) + 
  geom_point(colour = random_swatch_colour())

colorem <- random_swatch_colour()
ggplot(diamonds, aes(color, price)) + 
  geom_boxplot(fill = colorem, outlier.colour = colorem)

cttobin/ggthemr documentation built on April 18, 2018, 11:36 p.m.