plot3d: Interactive 3D plot of a RasterLayer

Description Usage Arguments Author(s) Examples

Description

Make an interactive 3D plot (map) of a RasterLayer. This is a wrapper around surface3d in the rgl package. You can use decorate3d to add axes.

Usage

1
2
3
## S4 method for signature 'RasterLayer'
plot3D(x, maxpixels=100000, 
   zfac=1, drape=NULL, col, rev=FALSE, adjust=TRUE, ...)

Arguments

x

a RasterLayer object

maxpixels

Maximum number of pixels to use

zfac

Numeric, to set the elevation scale relative to x and y

drape

RasterLayer, to 'drape' colors representing the values of this layer on the 3D representation of layer x. In this casex typically has elevation data

col

A color palette generating function such as rainbow, heat.colors, and topo.colors, or one or your own making

rev

Logical. If TRUE, the color palette values are reversed in order

adjust

Logical. If TRUE, the x and y axes are scaled relative to the cell (z) values

...

Any argument that can be passed to surface3d

Author(s)

Robert J. Hijmans

Examples

1
2
3
4
5
6
7
if (require(rgl)) {
data(volcano)
r <- raster(volcano)
extent(r) <- c(0, 610, 0, 870)
drape <- cut(r, 5)
plot3D(r, drape=drape, zfac=2)
}

Example output

Loading required package: raster
Loading required package: sp
Loading required package: lattice
Loading required package: latticeExtra
Loading required package: rgl
sh: 1: awk: Permission denied
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'. 
3: In .local(x, ...) :
  breaks are approximate, based on a sample of 5307 cells that are not NA

rasterVis documentation built on May 2, 2019, 6:49 p.m.