Learn R Programming

edar (version 0.0.6)

hexn: Generate hex colour codes

Description

Generate a vector of hex colour codes for the desired number of colours. Colours are generated by evenly splitting hue in the range [0,360] in the HCL colour space using grDevices::hcl. The output is meant to follow the default colours used in ggplot2::ggplot2.

Usage

hexn(n, show = FALSE)

Value

A vector of hex colour codes that can be used for plotting.

Arguments

n

<int> Number of colours to output.

show

<lgl> TRUE to show the output colours.

Examples

Run this code
hexn(6,FALSE)
hexn(4,TRUE)

Run the code above in your browser using DataLab