| plot_map {rayshader} | R Documentation |
Displays the map in the current device.
plot_map(hillshade, rotate = 0, asp = 1, keep_user_par = FALSE, ...)
hillshade |
Hillshade to be plotted. |
rotate |
Default '0'. Rotates the output. Possible values: '0', '90', '180', '270'. |
asp |
Default '1'. Aspect ratio of the resulting plot. Use 'asp = 1/cospi(mean_latitude/180)' to rescale lat/long at higher latitudes to the correct the aspect ratio. |
keep_user_par |
Default ‘TRUE'. Whether to keep the user’s 'par()' settings. Set to 'FALSE' if you want to set up a multi-pane plot (e.g. set 'par(mfrow)'). |
... |
Additional arguments to pass to the 'raster::plotRGB' function that displays the map. |
#Plotting the Monterey Bay dataset with bathymetry data
water_palette = colorRampPalette(c("darkblue", "dodgerblue", "lightblue"))(200)
bathy_hs = height_shade(montereybay, texture = water_palette)
#Set everything below 0m to water palette
montereybay %>%
sphere_shade(zscale=10) %>%
add_overlay(generate_altitude_overlay(bathy_hs, montereybay, 0, 0)) %>%
add_shadow(ray_shade(montereybay,zscale=50),0.3) %>%
plot_map()
#Correcting the aspect ratio for the latitude of Monterey Bay
extent_mb = attr(montereybay,"extent")
mean_latitude = mean(c(extent_mb@ymax,extent_mb@ymin))
montereybay %>%
sphere_shade(zscale=10) %>%
add_overlay(generate_altitude_overlay(bathy_hs, montereybay, 0, 0)) %>%
add_shadow(ray_shade(montereybay,zscale=50),0.3) %>%
plot_map(asp = 1/cospi(mean_latitude/180))