# dotsInPolys

0th

Percentile

##### Put dots in polygons

Make a list of point coordinate matrices for a dot density map

Keywords
spatial
##### Usage
dotsInPolys(pl, x, f = csr)
##### Arguments
pl
list of polygons of class polylist
x
integer vector of counts of same length as pl for dots
f
function to place points in polygons, either csr - completely spatially random or gridpts gridded points from the splancs package
##### Details

With f=csr (completely spatially random), the dots are placed in the polygon at random, f=gridpts - in a grid pattern (number of dots not guaranteed to be the same as the count). When the polygon is made up of more than one part, the dots will be placed in proportion to the relative areas of the clockwise rings (anticlockwise are taken as holes). No correction is made for holes in the placing of the dots.

##### Value

• The function returns a list of matrices of point coordinates, one matrix for each member of pl. If x[i] is zero, the list element is NULL, and can be tested when plotting - see the examples.

##### Note

Waller and Gotway (2004) Applied Spatial Statistics for Public Health Data (Wiley, Hoboken, NJ) explicitly warn that care is needed in plotting and interpreting dot density maps (pp. 81-83)

csr, gridpts

• dotsInPolys
##### Examples
x <- read.shape(system.file("shapes/sids.shp", package="maptools"))
ncpolys <- Map2poly(x)
try1 <- dotsInPolys(ncpolys, as.integer(x$att.data$SID74))
plot(ncpolys)
xx <- lapply(try1, function(x) {if (!is.null(x)) points(x, pch=18, col="red")})
try2 <- dotsInPolys(ncpolys, as.integer(x$att.data$SID74), f=gridpts)
plot(ncpolys)
xx <- lapply(try2, function(x) {if (!is.null(x)) points(x, pch=18, col="red")})
Documentation reproduced from package maptools, version 0.4-12, License: GPL version 2 or later (R and interface code), MIT (shapelib code)

### Community examples

Looks like there are no examples yet.