plot.shp: Plot shape files

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

View source: R/plot.R

Description

plot.shp plots a list of shapes

Usage

1
2
3
plot.shp(x, xlim, ylim, asp = 1/cos(sum(ylim)/360 * pi), add = FALSE,
         axes = FALSE, full = TRUE, hold = FALSE,
         col = "#e0e0e0", border = "#808080", ...)

Arguments

x

"shp" object as returned from read.shp

xlim

range to plot in x direction; defaults to the range of all bounding boxes

ylim

range to plot in x direction; defaults to the range of all bounding boxes

asp

aspect ratio; the default ensures least distortion in the center of the image

add

logical; if TRUE polygons are added to the existing plot and xlim, ylim, asp, axes, full are ignored. Otherwise a new plot is created.

axes

logical; passed to plot

.

full

logical; if TRUE then margins are removed for full-size plot, otherwise margins are not touched.

hold

logical; if TRUE then the drawing code is wrapped in dev.hold()/dev.flush()

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 col

...

additional arguments

Value

NULL invisibly

Note

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".

Author(s)

Simon Urbanek

See Also

read.shp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  # 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)

s-u/fastshp documentation built on May 28, 2019, 10:47 a.m.