Learn R Programming

gtx (version 0.0.8)

contrasting.rainbow: Rainbow of colours permuted to maximise contrast.

Description

Returns a rainbow of colours, permuted so that adjacent elements constrast each other as much as possible.

Usage

contrasting.rainbow(x, ...)

Arguments

x
number of colours in the rainbow.
...
other arguments to be passed to rainbow.

Value

A vector of colours of length x.

Details

The permutation is chosen by finding the largest coprime of x that is not greater than x/2, and using that coprime as an increment size to cycle through the normal rainbow.

Examples

Run this code
## contrasting colours suitable for Manhattan plot for 22 autosomes
plot(1:22, rep(1, 22), pch = 22, cex = 2, ann = FALSE, 
     yaxt = "n", bg = contrasting.rainbow(22))

Run the code above in your browser using DataLab