plot.tile.list {deldir}R Documentation

Plot Dirichlet (Voronoi) tiles

Description

A method for plot. Plots (sequentially) the tiles associated with each point in the set being tessellated.

Usage

## S3 method for class 'tile.list'
plot(x, verbose = FALSE, close = FALSE, pch = 1,
                         fillcol = getCol(x,warn=warn), col.pts=NULL,
                         col.lbls=NULL,border=NULL, showpoints = !labelPts,
                         add = FALSE, asp = 1, clipp=NULL, xlab = "x",
                         ylab = "y", main = "", axes=TRUE,warn=TRUE,
                         labelPts=FALSE,adj=NULL,...) 

Arguments

x

A list of the tiles in a tessellation, as produced the function tile.list().

verbose

Logical scalar; if TRUE the tiles are plotted one at a time (with a “Go?” prompt after each) so that the process can be watched.

close

Logical scalar; if TRUE the outer edges of of the tiles (i.e. the edges which are constitute parts of the edges of the enclosing rectangle) are drawn. Otherwise tiles on the periphery of the tessellation are left “open”.

pch

The plotting character (or vector of plotting characters) with which to plot the points of the pattern which was tessellated. Ignored if showpoints is FALSE.

fillcol

Optional vector (possibly of length 1, i.e. a scalar) whose entries can be interpreted as colours by col2rgb(). The i-th entry indicates with which colour to fill the i-th tile. Note that an NA entry cause the tile to be left unfilled. This argument will be replicated to have length equal to the number of tiles. The default value is created (using the tile “tags”, i.e. the z components of the tiles, if these exist) by the undocumented function getCol(). Note that if these z components are not present, then getCol() returns NA.

col.pts

Optional vector like unto fillcol whose entries can be interpreted as colours by col2rgb(). The i-th entry indicates with which colour to plot the i-th point. This argument will be replicated to have length equal to the number of tiles. Ignored if showpoints is FALSE.

col.lbls

Optional vector like unto col.pts. Determines the colours in which the point labels (see labelPts below) are plotted. This argument will be replicated to have length equal to the number of tiles. Ignored if labelPts is FALSE.

border

A scalar that can be interpreted as a colour by col2rgb(), indicating the colour with which to plot the tile boundaries. Defaults to black unless all of the fill colours specified by fillcol are black, in which case it defaults to white. If length(border) > 1 then only its first entry is used.

showpoints

Logical scalar; if TRUE the points of the pattern which was triangulated/tessellated are plotted. If clipp is specified, then only those points associated with non-empty clipped tiles are shown. Note that some such points will be external to the polygon clipp and that these “external” points are shown.

add

Logical scalar; should the plot of the tiles be added to an existing plot?

asp

The aspect ratio of the plot; integer scalar or NA. Set this argument equal to NA to allow the data to determine the aspect ratio and hence to make the plot occupy the complete plotting region in both x and y directions. This is inadvisable; see the Warnings.

clipp

An object specifying a polygon to which the tessellation being plotted should be clipped. It should consist either of:

  • a list containing two components x and y giving the coordinates of the vertices of a single polygon. The last vertex should not repeat the first vertex. Or:

  • a list of list(x,y) structures giving the coordinates of the vertices of several polygons.

If this argument is provided then the plot of the tessellation is “clipped” to the polygon specified by clipp.

xlab

Label for the x-axis (used only if add is FALSE).

ylab

Label for the y-axis (used only if add is FALSE).

main

A title for the plot (used only if add is FALSE).

axes

Logical scalar. Should axes (with a marked numeric scale) be plotted? This argument is used only if add is FALSE. It allows the plotting of such axes to be suppressed. The argument was added at the request of Damon Tutunjian. To suppress the plotting of axis labels set xlab="" and/or ylab="".

warn

Logical scalar passed to the internal function getCol(). Should a warning be issued if the z components of the entries of x cannot all be interpreted as colours? (See Notes.)

labelPts

Logical scalar; if TRUE the labels of the points determining the tiles are plotted in the tiles. Note that if labelPts is TRUE then showpoints defaults to FALSE

adj

The “adjustment” argument to text(). If labelPts and showpoints are both TRUE it defaults to -1 (so that the labels and point symbols are not superimposed). If labelPts is TRUE and showpoints is FALSE it defaults to 0. If labelPts is FALSE it is ignored.

...

Optional arguments; may be passed to points() and text().

Value

The list of tiles being plotted. This will be the input list of tiles specified by argument x, or this list clipped to the polygon clipp if the latter was specified.

Warnings

Notes

Author(s)

Rolf Turner rolfurner@posteo.net

See Also

deldir(), tile.list(), triang.list(), plot.triang.list()

Examples

  set.seed(42)
  x <- runif(20)
  y <- runif(20)
  z <- deldir(x,y,rw=c(0,1,0,1))
  w <- tile.list(z)
  plot(w)
  ccc <- heat.colors(20) # Or topo.colors(20), or terrain.colors(20)
                         # or cm.colors(20), or rainbow(20).
  plot(w,fillcol=ccc,close=TRUE)
  if(require(polyclip)) {
     CP  <- list(x=c(0.49,0.35,0.15,0.20,0.35,0.42,
                     0.43,0.62,0.46,0.63,0.82,0.79),
                 y=c(0.78,0.86,0.79,0.54,0.58,0.70,
                     0.51,0.46,0.31,0.20,0.37,0.54))
     cul <- rainbow(10)[c(1,7,3:6,2,8:10)] # Rearranging colours to improve
                                           # the contrast between contiguous tiles.
     plot(w,clipp=CP,showpoints=FALSE,fillcol=cul)
  }
  plot(w,labelPts=TRUE,col.lbls="red")
  plot(w,labelPts=TRUE,col.lbls="red",cex=0.5)
  plot(w,showpoints=TRUE,labelPts=TRUE,col.pts="green",col.lbls="red")
  plot(w,axes=FALSE,xlab="",ylab="",close=TRUE)

[Package deldir version 2.0-4 Index]