Skip to content

Instantly share code, notes, and snippets.

@EarlGlynn
Created April 20, 2015 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EarlGlynn/cd83013ef2e4c0bcc331 to your computer and use it in GitHub Desktop.
Save EarlGlynn/cd83013ef2e4c0bcc331 to your computer and use it in GitHub Desktop.
256 Shades of Gray/Grey in R
grays <- rep("", 256)
for (i in 1:256)
{
hex2 <- sprintf("%02x", i-1);
grays[i] <- paste0("#", hex2, hex2, hex2)
}
barplot(rep(1,256), col=grays, yaxt="n", border=NA, space=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment