gg_colour_hue: gg_colour_hue

Description Arguments Examples

View source: R/gg_colour_hue.R

Description

emulate colour scale for ggplots

Arguments

n

the number of colors (≥ 1) to be in the palette.

Examples

1
2
3
4
5
6
7
8
9
# example plot
n <- 5
x_mean <- rnorm(n, 1000, 500)
y_mean <- rnorm(n, 1000, 500)
x_vals <- sapply(x_mean, function(x) rnorm(100, x, 50))
y_vals <- sapply(y_mean, function(y) rnorm(100, y, 50))
plot(x_vals, y_vals, col = colourscale(n, brewer.pal(11, "Set3"))[unlist(lapply(1:n, function(x) rep(x, 100)))], pch = 20,
     legend = legend("topleft", title = "colours", legend = 1:n, col = colourscale(n, brewer.pal(11, "Set3")), pch = 20),
     main = "title", xlab = "x-axis", ylab = "y-axis")

TomKellyGenetics/tktools documentation built on Dec. 13, 2021, 10:06 p.m.