[R] plot map of areas
Roger Bivand
Roger.Bivand at nhh.no
Fri Nov 21 14:20:31 CET 2003
On Fri, 21 Nov 2003, Pascal A. Niklaus wrote:
> Hi all,
>
> Given a number of points (x,y) in a plane, I'd like to plot a map of
> polygons, so that
>
> 1) each polygon contains exactly one point
> 2) the polygon defines the area for which this specific point is
> closer than any other point.
>
> It's a bit like a map of areas "influenced" by that point, and it's
> obviously a matter of intersecting the perpendicular bisectors between
> adjacent points.
>
> I believe this type of map has a name, but I can't remember how it's
> called.
>
> Is there a function somewhere in a R package that may do this?
Try this:
> library(tripack)
> coords <- cbind(runif(100), runif(100))
> plot(coords, pch=19, col="blue")
> plot(voronoi.mosaic(coords[,1], coords[,2], duplicate = "remove"),
+ add=TRUE)
>
A Voronoi diagram? There are quite a lot of relevant functions in the
tripack package.
>
> Thanks for your help
>
> Pascal
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
More information about the R-help
mailing list