constant_shade: Calculate Constant Color Map

View source: R/constant_shade.R

constant_shadeR Documentation

Calculate Constant Color Map

Description

Generates a constant color layer.

Usage

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

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.

Value

RGB array of a single color layer.

Examples

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()
}

tylermorganwall/rayshader documentation built on Dec. 21, 2024, 4:29 p.m.