densityplot-methods: Density plots for Raster objects.

Description Usage Arguments Author(s) See Also Examples

Description

Draw kernel density plots (with lattice) of Raster objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## S4 method for signature 'RasterLayer,missing'
densityplot(x, data=NULL, maxpixels = 1e+05,
            xlab='', ylab='', main='', col='black', ...)


## S4 method for signature 'RasterStackBrick,missing'
densityplot(x, data=NULL, layers, FUN,
            maxpixels = 1e+05,
            xlab='', ylab='', main='',
            par.settings=rasterTheme(),
            ...)

## S4 method for signature 'formula,Raster'
densityplot(x, data, dirXY,
            maxpixels = 1e+05,
            xscale.components=xscale.raster,
            yscale.components=yscale.raster,
            auto.key = list(space = 'right'), 
            par.settings=rasterTheme(),...)

Arguments

x

A Raster* object or a formula.

data

NULL or a Raster object.

layers

A numeric or character which should indicate the layers to be displayed.

dirXY

A direction as a function of the coordinates (see xyLayer).

FUN

A function to applied to the z slot of a RasterStackBrick object. The result of this function is used as the grouping variable of the plot.

maxpixels

A numeric, for sampleRandom.

xlab, ylab, main, col, xscale.components, yscale.components, par.settings, auto.key

Arguments for densityplot.

...

Additional arguments for densityplot

Author(s)

Oscar Perpiñán Lamigueiro

See Also

densityplot,xscale.raster, yscale.raster, rasterTheme

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
densityplot(r)
s <- stack(r, r+500, r-500)
densityplot(s)

## Not run: 
##Solar irradiation data from CMSAF
##Data available from http://www.box.net/shared/rl51y1t9sldxk54ogd44

old <- getwd()
##change to your folder...
setwd('CMSAF')
listFich <- dir(pattern='2008')
stackSIS <- stack(listFich)
stackSIS <- stackSIS*24 ##from irradiance (W/m2) to irradiation Wh/m2
setwd(old)

idx <- seq(as.Date('2008-01-15'), as.Date('2008-12-15'), 'month')

SISmm <- setZ(stackSIS, idx)
names(SISmm) <- month.abb

densityplot(SISmm)
densityplot(SISmm, FUN=as.yearqtr)##FUN applies to z if not NULL

## End(Not run)
## Not run: 
##http://neo.sci.gsfc.nasa.gov/Search.html?group=64
pop <- raster('875430rgb-167772161.0.FLOAT.TIFF')
pop[pop==99999] <- NA
levelplot(pop, zscaleLog=10, par.settings=BTCTheme,
          panel=panel.levelplot.raster, interpolate=TRUE)

##http://neo.sci.gsfc.nasa.gov/Search.html?group=20
landClass <- raster('241243rgb-167772161.0.TIFF')
landClass[landClass==254] <- NA


s <- stack(pop, landClass)
names(s) <- c('pop', 'landClass')

densityplot(~asinh(pop)|landClass, data=s,
            scales=list(relation='free'),
            strip=strip.custom(strip.levels=TRUE))

## End(Not run)

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