[R] Coloring Dirichlet Tiles

baptiste auguie baptiste.auguie at googlemail.com
Sun Sep 4 22:59:29 CEST 2011


Hi,

Try this,

d <- data.frame(x=runif(1e3, 0, 30), y=runif(1e3, 0, 30))
d$z = (d$x - 15)^2 + (d$y - 15)^2

library(spatstat)
library(maptools)

W <- ripras(df, shape="rectangle")
W <- owin(c(0, 30), c(0, 30))
X <- as.ppp(d, W=W)
Y <- dirichlet(X)
Z <- as(Y, "SpatialPolygons")
plot(Z, col=grey(d$z/max(d$z)))

and also panel.voronoi in latticeExtra.

Unfortunately I do not know of a solution that uses more efficient
algorithms for computing the Dirichlet tessellation and extracting
tiles than those relying on deldir. The Triangle package (r-forge)
looks promising.

HTH,

baptiste


On 5 September 2011 06:26, awesolow <awesolow at andrew.cmu.edu> wrote:
> Hi,
>
> I have a set of x, y points (longitude/latitude) along with a z value
> representing an attribute at each point.  I want to create a
> Voronoi/Dirichlet tesselation of these points coloring each tile by the z
> value.  I tried searching for a way to solve this and it was suggested to
> use the dirichlet() command to get the correct coloring.  However, my
> coloring is not correct.
>
> Any thoughts?
>
> Thanks in advance.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Coloring-Dirichlet-Tiles-tp3789746p3789746.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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