Skip to content

Instantly share code, notes, and snippets.

@jsta
Created June 8, 2018 18:10
Show Gist options
  • Select an option

  • Save jsta/1b339d91043de98c3589b1bb3fb7db77 to your computer and use it in GitHub Desktop.

Select an option

Save jsta/1b339d91043de98c3589b1bb3fb7db77 to your computer and use it in GitHub Desktop.
Pull elevation data with the elevatr package and rayshade with rayshader package
library(raster)
library(elevatr)
library(rayshader)
library(reshape2)
library(ggplot2)
data(lake)
x <- get_elev_raster(lake, z = 12)
x_mat <- as.matrix(x)
x_rsh <- rayshader::rayshade(x_mat,
anglebreaks = seq(55,65,10),
sunangle = 315,
maxsearch = 100)
ggplot(data = reshape2::melt(x_rsh)) +
geom_tile(aes(x = Var1, y = Var2, fill = value)) +
scale_fill_viridis_c() +
theme_void() +
theme(legend.position = "none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment