Skip to content

Instantly share code, notes, and snippets.

@s-kganz

s-kganz/images.R Secret

Created January 16, 2021 18:52
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 s-kganz/51793b86adbebe23bfed2afd3bf390cb to your computer and use it in GitHub Desktop.
Save s-kganz/51793b86adbebe23bfed2afd3bf390cb to your computer and use it in GitHub Desktop.
Images that compare rainbow and grayscale color maps.
library(fields)
mtx <- rep(0, 10000)
mtx <- matrix(mtx, nrow=100, ncol=100)
for (i in 1:100){
for (j in 1:100){
mtx[i, j] <- i^2 + j^2
}
}
image.plot(
mtx,
col=rainbow(18050)
)
image.plot(
mtx,
col=gray.colors(18050, start=0, end=1)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment