gsGOCVisualize: Visualize grains of connectivity (GOC) tessellations at a...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/grainscape.R

Description

Given a series of GOC models built at different scales in a gsGOC object, visualize one the tessellations (i.e. scales) in these models. Visualization is by default in raster format. Vector based visualization is also possible.

Usage

1
gsGOCVisualize(gsGOC, whichThresh, sp = FALSE, doPlot=FALSE)

Arguments

gsGOC

A gsGOC object created by gsGOC

whichThresh

Integer giving the index of the threshold to visualize.

sp

Logical. If TRUE then produce a SpatialPolygonsDataFrame representation of the selected threshold. Requires also running gsGOC with sp=TRUE, and that the rgeos package is installed.

doPlot

Logical. If TRUE plots a raster (or vector if sp=TRUE) of the Voronoi tessellation at whichThresh for quick visualizations. For full control, manually produce plots using the $voronoi or $voronoiSP objects created by this function.

Value

A list object:

$summary giving the properties of the visualized scale of the GOC model
$voronoi giving the tessellation (RasterLayer)
$centroids the centroids of the polygons in the tessellation (SpatialPoints)
$voronoiSP vector representation of polygons in the tessellation (SpatialPolygonsDataFrame; if sp=TRUE)

Author(s)

Paul Galpern (pgalpern@gmail.com)

References

Fall, A., M.-J. Fortin, M. Manseau, D. O'Brien. (2007) Spatial graphs: Principles and applications for habitat connectivity. Ecosystems. 10:448:461

Galpern, P., M. Manseau, P.J. Wilson. (2012) Grains of connectivity: analysis at multiple spatial scales in landscape genetics. Molecular Ecology 21:3996-4009.

See Also

gsGOC

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
## Not run: 
## Load raster landscape
tiny <- raster(system.file("extdata/tiny.asc", package="grainscape"))

## Create a resistance surface from a raster using an is-becomes reclassification
tinyCost <- reclassify(tiny, rcl=cbind(c(1, 2, 3, 4), c(1, 5, 10, 12)))


## Produce a patch-based MPG where patches are resistance features=1
tinyPatchMPG <- gsMPG(cost=tinyCost, patch=tinyCost==1)

## Extract a representative subset of 5 grains of connectivity
tinyPatchGOC <- gsGOC(tinyPatchMPG, nThresh=5)

## Very quick visualization at the finest scale/grain/threshold
## Producing plot on the default graphics device
gsGOCVisualize(tinyPatchGOC, whichThresh=1, doPlot=TRUE)

## Visualize the model at the finest scale/grain/threshold
## Manual control of plotting
plot(gsGOCVisualize(tinyPatchGOC, whichThresh=1)$voronoi,
   col=sample(rainbow(100)), legend=FALSE, main="Threshold 1")

## Extract a representative subset of 5 grains of connectivity for vector visualization
tinyPatchGOC <- gsGOC(tinyPatchMPG, nThresh=5, sp=TRUE)

## Visualize the model at a selected scale/grain/threshold using vector polygons
plot(tinyPatchMPG$patchId, col="grey", legend=FALSE)
plot(gsGOCVisualize(tinyPatchGOC, whichThresh=3, sp=TRUE)$voronoiSP,
  add=TRUE, lwd=2)


## End(Not run)

grainscape documentation built on May 2, 2019, 6:48 p.m.