plot.polylist

0th

Percentile

Plot polygons

A helper function for plotting polygons in a global bounding box. findInterval2 is a modified version of findInterval2 that permits the vector of break points to start at -Inf and/or finish at Inf. leglabs makes character strings from the same break points. The plot.polylist() function may be used as a generic S3 method. NOTE! plotpolys() DEPRECATED: use generic plot() for polylist objects function instead.

Keywords
spatial
Usage
plot.polylist(x, col = NA, border = par("fg"), add = FALSE, xlim, ylim, ...)
leglabs(vec, under="under", over="over", between="-")
findInterval2(y, vec, rightmost.closed = FALSE, all.inside = TRUE)
plotpolys(pl, bb, col = NA, border = par("fg"), add = FALSE, xlim, ylim, ...)
Arguments
pl, x
list of polygons of class polylist
bb
matrix of polygon bounding boxes - columns are LL(x), LL(y), UR(x), UR(y); note that this argument may be omitted if the polygon list object has an "maplim" attribute, or if both xlim and ylim arguments are given
col
colurs to use for filling the polygons
border
the color to draw the border
add
add to existing plot
xlim, ylim
numeric of length 2, giving the x and y coordinates ranges
...
other arguments passed to polygon
vec
vector of break values
under
character value for under
over
character value for over
between
character value for between
y
numeric vector to be broken into class intervals
rightmost.closed
as in findInterval()
all.inside
as in findInterval()
See Also

Map2poly, findInterval

Aliases
  • plotpolys
  • plot.polylist
  • leglabs
  • findInterval2
Examples
try2 <- read.shape(system.file("shapes/columbus.shp", package="maptools")[1])
mappolys <- Map2poly(try2, as.character(try2$att.data$NEIGNO))
brks <- round(quantile(try2$att.data$CRIME, probs=seq(0,1,0.2)), digits=2)
colours <- c("salmon1", "salmon2", "red3", "brown", "black")
plot(mappolys, col=colours[findInterval2(try2$att.data$CRIME, brks)])
legend(x=c(5.8, 7.1), y=c(13, 14.5), legend=leglabs(brks),
  fill=colours, bty="n")
title(main=paste("Columbus OH: residential burglaries and vehicle
thefts",
  "per thousand households, 1980"))
try3 <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
mappolys <- Map2poly(try3, as.character(try3$att.data$FIPSNO))
cols <- c("white", "orange", "red")
np <- integer(length(mappolys))
for (i in 1:length(mappolys)) np[i] <- attr(mappolys[[i]], "nPart")
plot(mappolys, col=cols[np])
title(main="White: one part, orange: two part, red: three part polygons")
Documentation reproduced from package maptools, version 0.3-7, License: GPL version 2 or later (R and interface code), MIT (shapelib code)

Community examples

Looks like there are no examples yet.