[R] voronoi tessellations
Duncan Murdoch
murdoch at stats.uwo.ca
Wed Jul 19 22:32:43 CEST 2006
On 7/19/2006 4:21 PM, binabina at bellsouth.net wrote:
> Okay, been working with tripack, seems the most mature package for this. Got it to work well with their test data set - data(tritest). When i tried random numbers to explore further, i am getting some results that don't reconcile.
>
> example run this:
>
> library(tripack)
> y <- runif(100)
> x <- runif(100)
> vm <- voronoi.mosaic(x,y)
> plot(vm)
> par(new=T)
Don't do that! That throws away the coordinate system that has already
been established. Do it this way:
library(tripack)
y <- runif(100)
x <- runif(100)
vm <- voronoi.mosaic(x,y)
plot(vm)
points(x,y,col='blue')
and if you want the axes,
axis(1)
axis(2)
box()
Duncan Murdoch
> plot(x,y,col='blue')
>
> when you look at the plot of the mosaic overlayed with the raw data, the mosaic should have each data point in 1 cell, however that is not the case - any help would be appreciated.
>
> However if you run
>
> data(tritest)
> x <- tritest$x
> y <- tritest$y
> vm <- voronoi.mosaic(x,y)
> plot(vm)
> par(new=T)
> plot(x,y,col='blue')
>
> it looks at it should.
>
> -zubin
>
>
>> From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
>> Date: 2006/07/19 Wed AM 03:15:51 EDT
>> To: Don MacQueen <macq at llnl.gov>
>> CC: zubin <binabina at bellsouth.net>, r-help at stat.math.ethz.ch
>> Subject: Re: [R] voronoi tessellations
>>
>> On Tue, 18 Jul 2006, Don MacQueen wrote:
>>
>>> I'll suggest going to the CRAN packages page and doing a search for "voronoi".
>> The problem here is that `Voronoi tessellation' is a secondary name. The
>> concept has many names, including Dirichlet tessellation and Thiessen
>> polygons, and Dirichlet has priority over Voronoi.
>>
>>> Also, search for 'triangulation', since that is one of the uses of them.
>> I know of packages deldir, tripack and perhaps geometry.
>>
>>> -Don
>>>
>>> At 11:46 PM -0400 7/18/06, zubin wrote:
>>>> Hello, looking to draw a voronoi tessellations in R - can anyone
>>>> recommend a package that has tackled this?
>>>>
>>>> some background:
>>>>
>>>> i have a economic data set and created a sammons projection, like to now
>>>> overlay a voronoi tessellation over the sammons 2-D solution for a slick
>>>> visual, and potentially color each tessellation element based on a metric.
>>>>
>>>> home.u <- unique(home1)
>>>> home.dist <- dist(home.u)
>>>> home.sam <- sammon(home.dist,k=2)
>>>> plot(home.sam$points)
>> Wait a minute. If this is sammon() from MASS (uncredited), it is not a
>> projection, and there is no relevant concept of distance between points in
>> the mapped space apart from between the supplied points.
>>
>> I suggest Zubin reads carefully the reference whose support software he
>> appears to be using. (It would also have answered his question.)
>>
>> --
>> Brian D. Ripley, ripley at stats.ox.ac.uk
>> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford, Tel: +44 1865 272861 (self)
>> 1 South Parks Road, +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK Fax: +44 1865 272595
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list