vectorplot: Vector plots of Raster objects.

Description Usage Arguments Author(s) References See Also Examples

Description

vectorplot displays vector fields from Raster objects using arrows.

streamplot displays streamlines with a procedure inspired by the FROLIC algorithm (see references): for each point (droplet) of a jittered regular grid, a short streamline portion (streamlet) is calculated by integrating the underlying vector field at that point. The main color of each streamlet indicates local vector magnitude (slope). Streamlets are composed of points whose sizes, positions and color degradation encode the local vector direction (aspect).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## S4 method for signature 'Raster'
vectorplot(object, layers,
            narrows=2e3, lwd.arrows=0.6, length=unit(5e-2, 'npc'),
            maxpixels=1e5, region=TRUE,  
            isField=FALSE, reverse=FALSE, unit='radians', ...)

## S4 method for signature 'Raster'
streamplot(object, layers,
            droplet = list(), streamlet = list(),
            par.settings=streamTheme(),
            isField = FALSE, reverse=FALSE, 
            parallel=TRUE, mc.cores=detectCores(), cl=NULL,
            ...)

## S4 method for signature 'RasterStack'
streamplot(object, layers,
            droplet = list(), streamlet = list(),
            par.settings=streamTheme(),
            isField = FALSE, reverse=FALSE, 
            parallel=TRUE, mc.cores=detectCores(), cl=NULL,
            ...)

Arguments

object

A Raster object. If isField=FALSE the vector field is calculated internally from the result of terrain.

layers

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

maxpixels

A numeric, number of cells to be shown if region=TRUE.

narrows

A numeric, number of arrows.

lwd.arrows

Numeric, width of the lines of the arrows

length

Unit, extent of the arrow head.

droplet

A list whose elements define the droplet configuration:

  • cropExtent: Percentage of the object extent to be cropped (default .97) to avoid droplets at boundaries

  • pc: Percentage of cells to be used for the streamlets calculation (default .5)

streamlet

A list whose elements define the streamlet configuration:

  • L: length of the streamlet (number of points, default 10)

  • h: streamlet calculation step (default mean(res(object))).

par.settings

A list to define the graphical parameters. For streamplot there is an specific theme, streamTheme.

parallel

Logical, TRUE (default) to use parallel package.

cl

a cluster object. Read the help page of parLapply for details.

mc.cores

The number of cores to use if parallel=TRUE and no cl is provided. Read the help page of mclapply for details.

region

Logical, if TRUE the region is displayed with vectorplot using panel.levelplot.raster

reverse

Logical, TRUE if arrows or streamlets go against the direction of the gradient.

isField

Logical, if TRUE (the object is a vector field), object must be a Raster* with two layers, slope and aspect (in this order), following the philosophy of terrain.

unit

Character, angle units of the aspect layer if isField=TRUE: 'radians' or 'degrees'.

...

Additional arguments for levelplot

Author(s)

Oscar Perpiñán Lamigueiro

References

R. Wegenkittl and E. Gröller, Fast Oriented Line Integral Convolution for Vector Field Visualization via the Internet, Proceedings IEEE Visualization ’97, 1997, http://www.cg.tuwien.ac.at/research/vis-dyn-syst/frolic/frolic_crc.pdf

See Also

panel.arrows, levelplot, terrain, mclapply, parLapply

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
## Not run: 
proj <- CRS('+proj=longlat +datum=WGS84')

df <- expand.grid(x=seq(-2, 2, .01), y=seq(-2, 2, .01))
df$z <- with(df, (3*x^2 + y)*exp(-x^2-y^2))
r1 <- rasterFromXYZ(df, crs=proj)
df$z <- with(df, x*exp(-x^2-y^2))
r2 <- rasterFromXYZ(df, crs=proj)
df$z <- with(df, y*exp(-x^2-y^2))
r3 <- rasterFromXYZ(df, crs=proj)
s <- stack(r1, r2, r3)
names(s) <- c('R1', 'R2', 'R3')

vectorplot(r1)
vectorplot(r2, par.settings=RdBuTheme())
vectorplot(r3, par.settings=PuOrTheme())


## If no cluster is provided, streamplot uses parallel::mclapply except
## with Windows. Therefore, next code could spend a long time under
## Windows.
streamplot(r1)

## With a cluster
hosts <- rep('localhost', 4)
cl <- makeCluster(hosts)
streamplot(r2, cl=cl,
           par.settings=streamTheme(symbol=brewer.pal(n=5,
                                                      name='Reds')))
stopCluster(cl)

## Without parallel
streamplot(r3, parallel=FALSE,
           par.settings=streamTheme(symbol=brewer.pal(n=5,
                                                      name='Greens')))

## Configuration of droplets and streamlets
streamplot(s, layout=c(1, 3), droplet=list(pc=.2), streamlet=list(L=20),
           par.settings=streamTheme(cex=.6))

## End(Not run)

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