Yet another plot of R’s colors()
[This article was first published on Posts on GGVY, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I know there are plenty of these online, but I just thought about having my own for quick reference…
ncols <- ceiling(sqrt(length(colors())))^2 dat <- matrix(1:ncols, sqrt(ncols)) image(dat, col = colors()[1:ncols]) pos <- seq(0, 1, length.out = sqrt(ncols)) pos <- lapply(pos, function(x) cbind(x, pos)) pos <- do.call(rbind, pos) ncols <- length(colors()) text(x=pos[1:ncols,2], y=pos[1:ncols,1], labels = 1:ncols, cex=.75, srt=60)
To leave a comment for the author, please follow the link and comment on their blog: Posts on GGVY.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.