Example (from getcolors2 help):
#library(devtools) #install_github("marchtaylor/sinkr") library(sinkr) # Make synthetic data set.seed(1) 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)) # Select colors COLS <- getcolors2(4) # Plot data with selected colors 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)
No comments:
Post a Comment