rasterVis (version 0.51.6)

Formula methods: Formula methods

Description

Formula methods

Usage

# S4 method for formula,Raster
xyplot(x, data, dirXY, maxpixels=1e5,
            alpha=0.05,
            xscale.components=xscale.raster, yscale.components=yscale.raster,
            par.settings=rasterTheme(),...)
# S4 method for formula,Raster
hexbinplot(x, data, dirXY, maxpixels=1e6,
            xscale.components=xscale.raster, yscale.components=yscale.raster,
            par.settings=rasterTheme(),...)
# S4 method for formula,SpatRaster
xyplot(x, data, dirXY, maxpixels=1e5,
            alpha=0.05,
            xscale.components=xscale.raster, yscale.components=yscale.raster,
            par.settings=rasterTheme(),...)
# S4 method for formula,SpatRaster
hexbinplot(x, data, dirXY, maxpixels=1e6,
            xscale.components=xscale.raster, yscale.components=yscale.raster,
            par.settings=rasterTheme(),...)

Arguments

x

A formula describing the variables to be related. It may include the layer names (which are internally converted to valid ones with make.names) and the x, y variables representing the coordinates of the Raster object. Besides, if dirXY is not missing, the variable dirXY can also be included in the formula.

data

A Raster object or a SpatRaster object.

dirXY

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

maxpixels

A numeric, for sampleRegular or spatSample.

alpha

A numeric, transparency of the points.

xscale.components, yscale.components,par.settings

Customization of lattice. See xyplot for details.

...

Additional arguments for the xyplot and hexbinplot functions.

Author

Oscar Perpiñán Lamigueiro

Examples

Run this code
library(raster)
library(terra)

f <- system.file("external/test.grd", package="raster")
r <- raster(f)
names(r)

xyplot(test~y, data=r, alpha=0.5)

if (FALSE) {
dataURL <- "https://raw.github.com/oscarperpinan/bookvis/master/data/"

##Solar irradiation data from CMSAF http://dx.doi.org/10.5676/EUM_SAF_CM/RAD_MVIRI/V001
old <- setwd(tempdir())
download.file(paste0(dataURL, "SISmm2008_CMSAF.zip"),
   "SISmm2008_CMSAF.zip", method='wget')
unzip("SISmm2008_CMSAF.zip")

listFich <- dir(pattern='\\.nc')
stackSIS <- stack(listFich)
SISmm <- stackSIS*24 ##from irradiance (W/m2) to irradiation Wh/m2
setwd(old)

names(SISmm) <- month.abb

##Relation between the January & February versus July radiation for four
##differents longitude regions.
xyplot(Jan+Feb~Jul|cut(x, 4), data=SISmm, auto.key=list(space='right'))
##Faster with hexbinplot
hexbinplot(Jan~Jul|cut(x, 6), data=SISmm)
}

Run the code above in your browser using DataLab