# NOT RUN {
#Here, we overlay a base R elevation plot with our raytraced shadow layer:
fliplr = function(x) {
x[,ncol(x):1]
}
# }
# NOT RUN {
tempfilename = tempfile()
old.par = par(no.readonly = TRUE)
on.exit(par(old.par))
png(tempfilename,width = 401,height=401)
par(mar = c(0,0,0,0))
raster::image(fliplr(montereybay),axes = FALSE,col = rev(terrain.colors(1000)))
dev.off()
tempmap = png::readPNG(tempfilename)
# }
# NOT RUN {
# }
# NOT RUN {
montereybay %>%
ray_shade(zscale=50,maxsearch = 500,anglebreaks = seq(20,30,0.1)) %>%
add_overlay(tempmap,alphalayer = 0.5) %>%
plot_map()
# }
# NOT RUN {
#Combining base R plotting with rayshader's spherical color mapping and raytracing:
# }
# NOT RUN {
montereybay %>%
sphere_shade() %>%
add_overlay(tempmap,alphalayer = 0.4) %>%
add_shadow(ray_shade(montereybay,zscale=50,maxsearch = 500)) %>%
plot_map()
# }
Run the code above in your browser using DataLab