Skip to content

Instantly share code, notes, and snippets.

@jeffreyiacono
Last active December 12, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeffreyiacono/4747104 to your computer and use it in GitHub Desktop.
Save jeffreyiacono/4747104 to your computer and use it in GitHub Desktop.
fun with R's colorRampPalette + plot
pal <- colorRampPalette(c("red", "blue"))
plot(rnorm(1000), seq(1, 1000, by = 1)
, col = pal(1000)
, xlab = "x"
, ylab = "y"
, main = "Fun with rnorm + colorRampPalette")
# => view Plot 1
pal <- colorRampPalette(c("red", "yellow", "blue"))
plot(rnorm(1000), seq(1, 1000, by = 1)
, col = pal(1000)
, xlab = "x"
, ylab = "y"
, main = "Fun with rnorm + colorRampPalette (double rainbow)")
# => view Plot 2
pal <- colorRampPalette(c("dark blue", "light blue"))
plot(rnorm(1000), seq(1, 1000, by = 1)
, col = pal(1000)
, xlab = "x"
, ylab = "y"
, main = "Fun with rnorm + colorRampPalette (the blues)")
# => view Plot 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment