Panel function for adding spatial objects.

Share:

Description

Panel function adapted from the Sp package for displaying all kind of spatial objects handled by Sp (for classes inherited from the superclass Spatial) into a trellis graphic (lattice package).

Usage

1
2
adeg.panel.Spatial(SpObject, sp.layout = NULL, col = 1, border = 1, lwd = 1, 
  lty = 1, alpha = 0.8, cex = 1, pch = 20, n = length(col), spIndex = 1, ...)

Arguments

SpObject

an object of class "SpatialPoints", "SpatialPointsDataFrame",
"SpatialPixels", "SpatialPixelsDataFrame", "SpatialGrid",
"SpatialGridDataFrame", "SpatialLines", "SpatialLinesDataFrame",
"SpatialPolygons" or "SpatialPolygonsDataFrame"

sp.layout

a list of layout items. See spplot for more information

col

background color (fill) of Spobject

border

border color

lwd

line width (border)

lty

line type (border)

alpha

background transparency of Spobject

cex

point size

pch

point type

n

if SpObject contains data, the _desired_ number of intervals splitting the data (using pretty).

spIndex

if the SpObject contains a data frame, its values are represented with a color code. Only the spIndex data frame is represented

...

for coherence with panel functions

Value

Draws the Spatial object and layout.

Note

If SpObject contains several maps, only the first one is selected. Also for objects containing more data (for classes data.frame with a slot data), this information is also shown. To do so, various colors can be used (according to the col arguments).

For more information about the use of panel functions, please see the lattice package developed by Deepayan Sarkar.

Author(s)

Alice Julien-Laferriere, Aurelie Siberchicot aurelie.siberchicot@univ-lyon1.fr and Stephane Dray

References

Package Sp. Author: Edzer Pebesma, Roger Bivand, Barry Rowlingson and Virgilo Gomez-Rubio.

See Also

spplot sp.lines sp.polygons sp.grid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if(require(maptools, quiet = TRUE) & require(lattice, quiet = TRUE)) {

nc <- readShapePoly(system.file("shapes/sids.shp", package = "maptools")[1], 
  proj4string = CRS("+proj=longlat +datum=NAD27"))
xy <- coordinates(nc)
arrow <- list("SpatialPolygonsRescale", layout.north.arrow(), 
  offset = c(-76, 34.2), scale = 0.5)

xyplot(xy[, 2] ~ xy[, 1], aspect = "iso", panel = function(...){
  adeg.panel.Spatial(SpObject = nc, sp.layout = list(arrow), 
  col = colorRampPalette(c("yellow", "blue"))(52), border =
  "transparent")})
}

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.