plotSample: Plot sample and frame

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plot.sdrawSample.R

Description

Plot the sample and optionally the frame, background image (terrain), and lattice (if HAL sample).

Usage

1
2
3
4
5
6
7
8
plotSample(
  x,
  frame,
  lattice = FALSE,
  bbox = FALSE,
  add = FALSE,
  poly.fill = TRUE
)

Arguments

x

A SpatialPointsDataFrame produced by an SDraw sampling function. For example, as produced by sdraw(frame,n). This object is a standard Spatial PolygonsDataFrame object with additional attributes that record the sampling design.

frame

The sample frame used to draw the sample contained in x. This is either a SpatialPoints*, SpatialLines*, or SpatialPolygons* object.

lattice

Logical. Whether to plot the Halton Lattice if x is a HAL sample.

bbox

Logical. Whether to plot the bounding box if the sample has a bounding box attribute. This generally means x is a HAL or BAS sample. lattice==TRUE sets bbox == TRUE.

add

Logical. Whether to add to an existing plot. See Examples.

poly.fill

Logical. Whether to fill polygons (TRUE) or leave them transparent (FALSE). Only applies to SpatialPolygon* frames.

Value

Nothing (NULL is invisibly returned)

Author(s)

Trent McDonald

See Also

sdraw

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
data(WY)
samp <- sdraw(WY, 100, type="HIP", J=c(4,3))
plotSample( samp, WY )
plotSample( samp, WY, lattice=TRUE )

# A map-like background under frame and sample ----
# Requires 'OpenStreetMap' package and internet connection
## Not run: 
library(OpenStreetMap)
# 1:convert to Lat-Long
WY.ll <- spTransform(WY, CRS("+init=epsg:4326"))
# 2:Specify bounding box for OpenStreetMap
bb.openmap <- bbox(WY.ll)
ULcoords <- c(bb.openmap[2,2], bb.openmap[1,1])
BRcoords <- c(bb.openmap[2,1], bb.openmap[1,2])
# 3:Fetch image (see 'openmap' help for 'type' parameter)
openMap <- OpenStreetMap::openmap(ULcoords, BRcoords, type = "esri")
# 4:Project background image to original coordinate system
openMap <- OpenStreetMap::openproj(openMap, projection = CRS(proj4string(WY))) 
# 5:plot background
plot(openMap)
# 6:plot frame and sample
plotSample(samp, WY, add=TRUE, poly.fill=FALSE)

## End(Not run)

SDraw documentation built on July 8, 2020, 6:23 p.m.