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 |
verbose |
Logical scalar; if |
close |
Logical scalar; if |
pch |
The plotting character (or vector of plotting
characters) with which to plot the points of the pattern which
was tessellated. Ignored if |
fillcol |
Optional vector (possibly of length 1, i.e. a scalar) whose
entries can be interpreted as colours by |
col.pts |
Optional vector like unto |
col.lbls |
Optional vector like unto |
border |
A scalar that can be interpreted as a colour by |
showpoints |
Logical scalar; if |
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
|
clipp |
An object specifying a polygon to which the tessellation being plotted should be clipped. It should consist either of:
If this argument is provided then the plot of the tessellation
is “clipped” to the polygon specified by |
xlab |
Label for the |
ylab |
Label for the |
main |
A title for the plot (used only if |
axes |
Logical scalar. Should axes (with a marked numeric scale)
be plotted? This argument is used only if |
warn |
Logical scalar passed to the internal function |
labelPts |
Logical scalar; if |
adj |
The “adjustment” argument to |
... |
Optional arguments; may be passed to |
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
As of release 1.0-8 the argument
number
ofplot.deldir()
andplot.tile.list()
was changed tolabelPts
. As a consequence the argumentcol.num
of this function has had its name changed tocol.lbls
.The behaviour of this function with respect to “clipping” has changed substantially since the previous release of
deldir
, i.e. 1.1-0. The argumentclipwin
has been re-namedclipp
(“p” for “polygon”). Clipping is now effected via the new packagepolyclip
. Thespatstat
package is no longer used. The argumentuse.gpclib
has been eliminated, sincegpclib
(which used to be called upon byspatstat
has been superseded bypolyclip
which has an unrestrictive license.As of release 0.1-1 of the
deldir
package, the argumentfillcol
to this function replaces the old argumentpolycol
, but behaves somewhat differently.The argument
showrect
which was present in versions of this function prior to release 0.1-1 has been eliminated. It was redundant.As of release 0.1-1 the
col.pts
argument might behave somewhat differently from how it behaved in the past.The arguments
border
,clipp
, andwarn
are new as of release 0.1-1.Users, unless they really understand what they are doing and why they are doing it, are strongly advised not to set the value of
asp
but rather to leaveasp
equal to its default value of1
. Any other value distorts the tesselation and destroys the perpendicular appearance of lines which are indeed perpendicular. (And conversely can cause lines which are not perpendicular to appear as if they are.) The argumentasp
was added at the request of Zubin Dowlaty (who presumably knows what he's doing!).
Notes
If
clipp
is notNULL
andshowpoints
isTRUE
then it is possible that some of the points “shown” will not fall inside any of the plotted tiles. (This will happen if the parts of the tiles in which they fall have been “clipped” out.) If a tile is clipped out completely then the point which determines that tile is not plotted irrespective of the value ofshowpoints
.If the
z
components of the entries ofx
exist but cannot all be interpreted as colours then the internal functiongetCol()
returnsNA
. Ifwarn
isTRUE
then a warning is issued. The functiongetCol()
will also returnNA
(no warning is issued in this case) if there aren't anyz
components. This circumstance will arise if noz
argument was supplied in the call todeldir()
. AnNA
value offillcol
results (as is indicated by the argument list entry forfillcol
) in (all of) the tiles being left unfilled.The change from argument
polycol
to argumentfillcol
, and the resulting change in the way in which plotted tiles are filled with colours, was made as a result of a request from Chris Triggs. Likewise the argumentclipp
was added due to a request from Chris Triggs.
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)