# Coloring Dirichlet Tiles

4 messages
Open this post in threaded view
|

## Coloring Dirichlet Tiles

 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.
Open this post in threaded view
|

## Re: Coloring Dirichlet Tiles

 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 <[hidden email]> 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. > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.