Learn R Programming

rasterVis (version 0.21)

histogram-methods: Histogram of Raster objects.

Description

Draw histograms (with lattice) of Raster objects.

Usage

## S3 method for class 'RasterLayer,missing':
histogram(x, data=NULL, maxpixels = 1e+05, nint=100, 
            xlab='', ylab='', main='', col='gray', ...)

## S3 method for class 'RasterStackBrick,missing': histogram(x, data=NULL, layers, FUN, maxpixels = 1e+05, nint=100, xlab='', ylab='', main='', col='gray', between=list(x=0.5, y=0.2), as.table=TRUE, xscale.components=xscale.raster, yscale.components=yscale.raster, scales=list(x=list(relation='free'), y=list(relation='free', draw=FALSE)), strip.names=c(TRUE, TRUE), par.settings=rasterTheme(), ...)

## S3 method for class 'formula,Raster': histogram(x, data, dirXY, maxpixels = 1e+05, xscale.components=xscale.raster, yscale.components=yscale.raster, strip=TRUE, par.settings=rasterTheme(),...)

Arguments

docType

methods

See Also

histogram,xscale.raster, yscale.raster, rasterTheme

Examples

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

##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

histogram(SISmm)
histogram(SISmm, FUN=as.yearqtr)

##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')

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

Run the code above in your browser using DataLab