SCM Repository

[latticeextra] View of /www/man/panel.voronoi.html
ViewVC logotype

View of /www/man/panel.voronoi.html

Parent Directory Parent Directory | Revision Log Revision Log

Revision 143 - (download) (as text) (annotate)
Tue May 25 06:54:57 2010 UTC (9 years ago) by felix
File size: 4792 byte(s)
get rid of ".featured_example", just use example number
<html><head><title>R: Panel functions for level-coded irregular points</title>


<table width="100%" summary="page for panel.voronoi {latticeExtra}"><tr><td>panel.voronoi {latticeExtra}</td><td align="right">R Documentation</td></tr></table>

<h2>Panel functions for level-coded irregular points</h2>


These panel functions for <code>levelplot</code>
can represent irregular (x, y) points with a color covariate.
<code>panel.levelplot.points</code> simply draws color-coded points.
<code>panel.voronoi</code> uses the <span class="pkg">deldir</span> package to
calculate the spatial extension of a set of points in 2 dimensions.
This is known variously as a Voronoi mosaic, a Dirichlet tesselation,
or Thiessen polygons.


panel.voronoi(x, y, z, subscripts = TRUE, at = pretty(z),
   points = TRUE, border = "transparent",
   na.rm = FALSE, win.expand = 0.07, use.tripack = FALSE,
   col.regions = regions$col, alpha.regions = regions$alpha)

panel.levelplot.points(x, y, z, subscripts = TRUE, at = pretty(z),
   shrink, labels,, contour, region,
   pch = 21, col.symbol = "#00000044",
   col.regions = regions$col, fill = NULL)


<table summary="R argblock">
<tr valign="top"><td><code>x, y, z</code></td>
 an irregular set of points at locations (x, y) with
value z. </td></tr>
<tr valign="top"><td><code>subscripts</code></td>
 integer vector indicating what subset of x, y and z
to draw. Typically passed by <code>levelplot</code>. </td></tr>
<tr valign="top"><td><code>at, col.regions, alpha.regions</code></td>
 color scale definition;
see <code>panel.levelplot</code>. </td></tr>
<tr valign="top"><td><code>points</code></td>
 whether to draw the (x, y) points. </td></tr>
<tr valign="top"><td><code>border</code></td>
 color for polygon borders. </td></tr>
<tr valign="top"><td><code>na.rm</code></td>
 if <code>TRUE</code>, points with missing <code>z</code> values will
be excluded from the calculation of polygons. If <code>FALSE</code>,
those polygons are calculated but are not drawn (i.e. are
transparent). </td></tr>
<tr valign="top"><td><code>win.expand</code></td>
 defines the rectangular window bounding the
polygons. This is a factor by which
to expand the range of the data. Set to 0 to limit drawing at the
furthest data point locations. Ignored if <code>use.tripack = TRUE</code>. </td></tr>
<tr valign="top"><td><code>use.tripack</code></td>
 if <code>TRUE</code>, use <span class="pkg">tripack</span> package rather
than <span class="pkg">deldir</span>. See Details. </td></tr>
<tr valign="top"><td><code>...</code></td>
 further arguments are
passed to <code>panel.xyplot</code> if <code>points =
      TRUE</code>. </td></tr>
<tr valign="top"><td><code>pch, col.symbol</code></td>
 symbol and border color for points.
A filled symbol should be used, i.e. in the range 21-25. </td></tr>
<tr valign="top"><td><code>shrink, labels,, contour, region, fill</code></td>
 ignored. </td></tr>


The <span class="pkg">tripack</span> package implementation is faster than <span class="pkg">deldir</span> but not under a
fully free licence. Also, the <span class="pkg">deldir</span> package allows polygons to
be clipped to a rectangular window (the <code>win.expand</code> argument).


<p> Felix Andrews <a href=""></a> </p>

<h3>See Also</h3>

<p> <code><a href="#tileplot">tileplot</a></code>,
<code><a href="../../deldir/html/deldir.html">deldir</a></code>  </p>


## a variant of Figure 5.6 from Sarkar (2008)

depth.ord &lt;- rev(order(quakes$depth))
quakes$Magnitude &lt;- equal.count(quakes$mag, 4)
quakes.ordered &lt;- quakes[depth.ord, ]

levelplot(depth ~ long + lat | Magnitude, data = quakes.ordered,
         panel = panel.levelplot.points, type = c("p", "g"),
         aspect = "iso", prepanel = prepanel.default.xyplot)

## a levelplot with jittered cells

xyz &lt;- expand.grid(x = 0:9, y = 0:9)
xyz[] &lt;- jitter(as.matrix(xyz))
xyz$z &lt;- with(xyz, sqrt((x - 5)^2 + (y - 5)^2))
levelplot(z ~ x * y, xyz, panel = panel.voronoi, points = FALSE)

## hexagonal cells

xyz$y &lt;- xyz$y + c(0, 0.5)
levelplot(z ~ x * y, xyz, panel = panel.voronoi, points = FALSE)

<div align="center">[Package <em>latticeExtra</em> version 0.6-12 <a href="00Index.html">Index</a>]</div>
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge