tileplot            package:latticeExtra            R Documentation

_P_l_o_t _a _s_p_a_t_i_a_l _m_o_s_a_i_c _f_r_o_m _i_r_r_e_g_u_l_a_r _2_D _p_o_i_n_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Represents an irregular set of (x, y) points with a color
     covariate. Polygons are drawn enclosing the area closest to each
     point. This is known variously as a Voronoi mosaic, a Dirichlet
     tesselation, or Thiessen polygons.

_U_s_a_g_e:

     tileplot(x, data = NULL, aspect = "iso",
              prepanel = "prepanel.default.xyplot",
              panel = "panel.voronoi", ...)

_A_r_g_u_m_e_n_t_s:

 x, data: formula and data as in 'levelplot', except that it expects
          irregularly spaced points rather than a regular grid. 

  aspect: aspect ratio: "iso" is recommended as it reproduces the
          distances used in the triangulation calculations. 

panel, prepanel: see 'xyplot'. 

     ...: further arguments to the panel function, which defaults to
          'panel.voronoi'. 

_D_e_t_a_i_l_s:

     See 'panel.voronoi' for further options and details.

_A_u_t_h_o_r(_s):

     Felix Andrews felix@nfrac.org

_S_e_e _A_l_s_o:

     'panel.voronoi', 'levelplot'

_E_x_a_m_p_l_e_s:

     xyz <- data.frame(x = rnorm(100), y = rnorm(100), z = rnorm(100))
     tileplot(z ~ x * y, xyz)

     ## tripack is faster but non-free
     ## Not run: 
     tileplot(z ~ x * y, xyz, use.tripack = TRUE)
     ## End(Not run)

     ## showing rectangular window boundary
     tileplot(z ~ x * y, xyz, xlim = c(-2, 4), ylim = c(-2, 4))

     ## insert some missing values
     xyz$z[1:10] <- NA
     ## the default na.rm = FALSE shows missing polygons
     tileplot(z ~ x * y, xyz, border = "black",
       col.regions = grey.colors(100),
       pch = ifelse(is.na(xyz$z), 4, 21),
       panel = function(...) {
         panel.fill("hotpink")
         panel.voronoi(...)
       })
     ## use na.rm = TRUE to ignore points with missing values
     update(trellis.last.object(), na.rm = TRUE)

     ## a quick and dirty approximation to US state boundaries
     tmp <- state.center
     tmp$Income <- state.x77[,"Income"]
     tileplot(Income ~ x * y, tmp, border = "black",
       panel = function(x, y, ...) {
         panel.voronoi(x, y, ..., points = FALSE)
         panel.text(x, y, state.abb, cex = 0.6)
       })

