Learn R Programming

rayshader (version 0.5.1)

plot_3d: plot_3d

Description

Displays the shaded map in 3D with the `rgl` package.

Usage

plot_3d(hillshade, heightmap, zscale = 1, solid = TRUE,
  soliddepth = "auto", solidcolor = "grey20",
  solidlinecolor = "grey40", shadow = TRUE, shadowdepth = "auto",
  shadowcolor = "grey50", shadowwidth = "auto", water = FALSE,
  waterdepth = 0, watercolor = "lightblue", wateralpha = 0.5,
  waterlinecolor = NULL, waterlinealpha = 1, linewidth = 2,
  theta = 45, phi = 45, fov = 0, zoom = 1, background = "white",
  windowsize = c(600, 600), ...)

Arguments

hillshade

Hillshade/image to be added to 3D surface map.

heightmap

A two-dimensional matrix, where each entry in the matrix is the elevation at that point. All points are assumed to be evenly spaced.

zscale

Default `1`. The ratio between the x and y spacing (which are assumed to be equal) and the z axis. For example, if the elevation levels are in units of 1 meter and the grid values are separated by 10 meters, `zscale` would be 10. Adjust the zscale down to exaggerate elevation features.

solid

Default `TRUE`. If `FALSE`, just the surface is rendered.

soliddepth

Default `auto`, which sets it to the lowest elevation in the matrix minus one unit (scaled by zscale). Depth of the solid base.

solidcolor

Default `grey20`. Base color.

solidlinecolor

Default `grey40`. Base edge line color.

shadow

Default `TRUE`. If `FALSE`, no shadow is rendered.

shadowdepth

Default `auto`, which sets it to `soliddepth - soliddepth/10`. Depth of the shadow layer.

shadowcolor

Default `grey50`. Color of the shadow.

shadowwidth

Default `auto`, which sizes it to 1/10th the smallest dimension of `heightmap`. Width of the shadow in units of the matrix.

water

Default `FALSE`. If `TRUE`, a water layer is rendered.

waterdepth

Default `0`. Water level.

watercolor

Default `lightblue`. Color of the water.

wateralpha

Default `0.5`. Water transparency.

waterlinecolor

Default `NULL`. Color of the lines around the edges of the water layer.

waterlinealpha

Default `1`. Water line tranparency.

linewidth

Default `2`. Width of the edge lines in the scene.

theta

Default `45`. Rotation around z-axis.

phi

Default `45`. Azimuth angle.

fov

Default `0`--isometric. Field-of-view angle.

zoom

Default `1`. Zoom factor.

background

Default `grey10`. Color of the background.

windowsize

Default `c(600,600)`. Width and height of the `rgl` device displaying the plot.

...

Additional arguments to pass to the `rgl::par3d` function.

Examples

Run this code
# NOT RUN {
#Plotting a spherical texture map of the built-in `montereybay` dataset.
# }
# NOT RUN {
montereybay %>%
 sphere_shade(texture="desert") %>%
 plot_3d(montereybay,zscale=50)
# }
# NOT RUN {
#With a water layer  
# }
# NOT RUN {
montereybay %>%
 sphere_shade(texture="imhof2") %>%
 plot_3d(montereybay, zscale=50, water = TRUE, watercolor="imhof2", 
         waterlinecolor="white", waterlinealpha=0.5)
# }

Run the code above in your browser using DataLab