Learn R Programming

rasterVis (version 0.41)

bwplot-methods: Box and whisker plots of Raster objects.

Description

Methods for bwplot and RasterStackBrick objects using a combination of panel.violin and panel.bwplot to compose the graphic.

Usage

# S4 method for RasterStackBrick,missing
bwplot(x, data=NULL, layers, FUN,
            maxpixels = 1e+05,
            xlab='', ylab='', main='',
            violin=TRUE,
            par.settings=rasterTheme(),
            scales=list(x=list(rot=45, cex=0.8)),
            ...)
# S4 method for formula,Raster
bwplot(x, data, dirXY, 
            maxpixels = 1e+05,
            xscale.components=xscale.raster,
            yscale.components=yscale.raster,
            horizontal=FALSE,
            violin=TRUE,
            par.settings=rasterTheme(),
            ...)

Arguments

x

A RasterStackBrick 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.

xscale.components, yscale.components

Graphical parameters of lattice. See xyplot for details.

horizontal

Defaults to FALSE, meaning that the right hand of the formula is a factor or shingle.

xlab, ylab, main

Labels for axis and title

violin

Logical, if TRUE the panel is built with panel.violin and panel.bwplot.

par.settings, scales

See xyplot for details.

Additional arguments for bwplot

See Also

bwplot, panel.violin, subset

Examples

Run this code
# NOT RUN {
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
s <- stack(r, r-500, r+500)
bwplot(s)

# }
# NOT RUN {
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

bwplot(SISmm)
##FUN applies to z if not NULL
bwplot(SISmm, FUN=as.yearqtr)
# }
# 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')

bwplot(asinh(pop) ~ landClass|cut(y, 3), data=s,
       layout=c(3, 1), violin=FALSE)

bwplot(asinh(pop) ~ cut(y, 5)|landClass, data=s,
       scales=list(x=list(rot=45)), layout=c(4, 5),
       strip=strip.custom(strip.levels=TRUE))
# }

Run the code above in your browser using DataLab