Description Usage Arguments Value Author(s) See Also Examples
View source: R/plot.sdrawSample.R
Plot the sample and optionally the frame, background image (terrain), and lattice (if HAL sample).
1 2 3 4 5 6 7 8 |
x |
A |
frame |
The sample frame used to draw the sample contained in |
lattice |
Logical. Whether to plot the Halton Lattice if |
bbox |
Logical. Whether to plot the bounding box if the sample
has a bounding box attribute. This generally means |
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 |
Nothing (NULL is invisibly returned)
Trent McDonald
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.