plot.shp {fastshp}R Documentation

Plot shape files

Description

plot.shp plots a list of shapes

Usage

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

  # 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)

[Package fastshp version 0.1-0 Index]