rgb2spLayout: Convert an RGB RasterBrick/Stack to use with spplot

Description Usage Arguments Author(s) See Also Examples

Description

This function takes a red-green-blue Raster* object and produces a list with color information that can be passed on to the 'sp.layout' argument from spplot.

Usage

1
rgb2spLayout(x, quantiles = c(0.02, 0.98), alpha = 1)

Arguments

x

A 3-layered Raster* object.

quantiles

Upper and lower quantiles used for color stretching.

alpha

Level of transparency.

Author(s)

Tim Appelhans, Florian Detsch

See Also

plotRGB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(raster)
library(sp)

b <- brick(system.file("external/rlogo.grd", package="raster"))

## using plotRGB
plotRGB(b)

## convert brick to list
lout <- rgb2spLayout(b)
lout_alph <- rgb2spLayout(b, alpha = 0.5)

## create random spatial points for plotting
df <- data.frame(dat = rnorm(100, 2, 1),
                 x = rnorm(100, 50, 20),
                 y = rnorm(100, 50, 25))
coordinates(df) <- ~x+y

## plot spatial points with rgb background
spplot(df, sp.layout = lout)
spplot(df, sp.layout = lout_alph)

Orcs documentation built on May 2, 2019, 2:37 a.m.