plot.shp {fastshp} | R Documentation |
plot.shp
plots a list of shapes
plot.shp(x, xlim, ylim, asp = 1/cos(sum(ylim)/360 * pi), add = FALSE,
axes = FALSE, full = TRUE, hold = FALSE,
col = "#e0e0e0", border = "#808080", ...)
x |
|
xlim |
range to plot in |
ylim |
range to plot in |
asp |
aspect ratio; the default ensures least distortion in the center of the image |
add |
logical; if |
axes |
logical; passed to |
.
full |
logical; if |
hold |
logical; if |
col |
colors for the shapes; each shape (possibly consisting of multiple polygons) consumes one element |
border |
borders for the shapes; consumer and recycled jsut like
|
... |
additional arguments |
NULL
invisibly
It is most efficient to plot the result of read.shp(...,
format="list")
. All other types are converted into that type before
plotting. It is most inefficient to use format="table"
.
Simon Urbanek
# Census 2010 TIGER/Line(TM) state shapefile
fn <- system.file("shp", "tl_2010_us_state10.shp.xz", package="fastshp")
# contrary to the advice above we use the table format, because
# it is a huge file with many points, so we use constrained thinning
# which works on tables
s <- read.shp(xzfile(fn, "rb"), "table")
# substantially reduce the number of points
s <- s[thin.shp(s, 0.01),]
# focus on continental US only
q <- list(x=c(-127.35, -65), y = c(51.5, 22.23))
plot.shp(s, q$x, q$y)