Description Usage Arguments Author(s) See Also Examples
Choose colours for plotting directly from a plot.
1 | getcolours(n)
|
n |
Number of colours. |
Me nugget (http://menugget.blogspot.co.uk/)
http://menugget.blogspot.co.uk/2013/01/choosing-colors-visually-with-getcolors.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | set.seed(1111)
n <- 100
x <- seq(n)
y1 <- cumsum(rnorm(n))
y2 <- cumsum(rnorm(n))
y3 <- cumsum(rnorm(n))
y4 <- cumsum(rnorm(n))
ylim <- range(c(y1,y2,y3,y4))
COLS <- getcolours(4)
x11()
plot(x, y1, ylim=ylim, t="l", col=COLS[1], lwd=3, ylab="")
lines(x, y2, col=COLS[2], lwd=3)
lines(x, y3, col=COLS[3], lwd=3)
lines(x, y4, col=COLS[4], lwd=3)
legend("topleft", legend=paste("y", 1:4, sep=""), col=COLS, lwd=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.