Learn R Programming

rayshader (version 0.37.3)

constant_shade: Calculate Constant Color Map

Description

Generates a constant color layer.

Usage

constant_shade(heightmap, color = "white", alpha = 1)

Value

RGB array of a single color layer.

Arguments

heightmap

A two-dimensional matrix, where each entry in the matrix is the elevation at that point.

color

Default `"white"`. Color for the constant layer.

alpha

Default `1`, the alpha transparency.

Examples

Run this code
if(run_documentation()) {
#Shade a red map
montereybay %>%
 constant_shade("red") %>%
 add_shadow(lamb_shade(montereybay),0) |> 
 plot_map()
}
if(run_documentation()) {
#Shade a green map
montereybay %>%
 constant_shade("green") %>%
 add_shadow(lamb_shade(montereybay),0) |> 
 plot_map()
}
if(run_documentation()) {
#Add a blue tint
montereybay %>%
 height_shade() |> 
 add_overlay(constant_shade(montereybay, "dodgerblue", alpha=0.25)) %>%
 add_shadow(lamb_shade(montereybay,zscale=50),0) |> 
 plot_map()
}
if(run_documentation()) {
#Use a blank map on which to draw other data
montereybay %>%
 constant_shade() %>%
 add_overlay(generate_line_overlay(monterey_roads_sf, linewidth=5, color="black",
                                   attr(montereybay,"extent"), width = 1080, height = 1080),
                                   alphalayer=0.8)  %>%
 add_water(detect_water(montereybay < 0), "dodgerblue") %>%
 plot_map()
}

Run the code above in your browser using DataLab