plot.tess: Plot a Tessellation

plot.tessR Documentation

Plot a Tessellation

Description

Plots a tessellation, with optional labels for the tiles, and optional filled colour in each tile.

Usage

  ## S3 method for class 'tess'
plot(x, ..., main, add=FALSE,
                      show.all=!add,
                      border=NULL,
                      do.plot=TRUE,
                      do.labels=!missing(labels),
                      labels=tilenames(x), labelargs=list(),
                      do.col=!missing(values),
                      values=marks(x),
                      multiplot=TRUE, 
                      col=NULL, ribargs=list())

Arguments

x

Tessellation (object of class "tess") to be plotted.

...

Arguments controlling the appearance of the plot.

main

Heading for the plot. A character string.

add

Logical. Determines whether the tessellation plot is added to the existing plot.

show.all

Logical value indicating whether to plot everything including the main title and the observation window of x.

border

Colour of the tile boundaries. A character string or other value specifying a single colour. Ignored for pixel tessellations.

do.plot

Logical value indicating whether to actually perform the plot.

do.labels

Logical value indicating whether to show a text label for each tile of the tessellation. The default is TRUE if labels are given, and FALSE otherwise.

labels

Character vector of labels for the tiles.

labelargs

List of arguments passed to text.default to control display of the text labels.

do.col

Logical value indicating whether tiles should be filled with colour (for tessellations where the tiles are rectangles or polygons). The default is TRUE if values are given, and FALSE otherwise.

values

A vector of numerical values (or a factor, or vector of character strings) that will be associated with each tile of the tessellation and which determine the colour of the tile. The default is the marks of x. If the tessellation is not marked, or if the argument values=NULL is given, the default is a factor giving the tile identifier.

multiplot

Logical value giving permission to display multiple plot panels. This applies when do.col=TRUE and ncol(values) > 1.

col

A vector of colours for each of the values, or a colourmap that maps these values to colours.

ribargs

List of additional arguments to control the plot of the colour map, if do.col=TRUE. See explanation in plot.im.

Details

This is a method for the generic plot function for the class "tess" of tessellations (see tess).

The window of the tessellation is plotted, and then the tiles of the tessellation are plotted in their correct positions in the window.

Rectangular or polygonal tiles are plotted individually using plot.owin, while a tessellation represented by a pixel image is plotted using plot.im. The arguments ... control the appearance of the plot, and are passed to segments, plot.owin or plot.im as appropriate.

If do.col=TRUE, then the tiles of the tessellation are filled with colours determined by the argument values. By default, these values are the marks associated with each of the tiles. If there is more than one column of marks or values, then the default behaviour (if multiplot=TRUE) is to display several plot panels, one for each column of mark values. Then the arguments ... are passed to plot.solist to determine the arrangement of the panels.

If do.labels=TRUE, a text label is plotted in the middle of each tile. The text labels are determined by the argument labels, and default to the names of the tiles given by tilenames(x).

Value

(Invisible) window of class "owin" specifying a bounding box for the plot, or an object of class "colourmap" specifying the colour map. (In the latter case, the bounding box information is available as an attribute, and can be extracted using as.owin.)

Author(s)

\spatstatAuthors

.

See Also

tess

Examples

  Rect <- tess(xgrid=0:4,ygrid=0:4)
  Diri <- dirichlet(runifrect(7))
  plot(Diri)
  plot(Rect, border="blue", lwd=2, lty=2)
  plot(Rect, do.col=TRUE, border="white")
  plot(Rect, do.col=TRUE, values=runif(16), border="white")
  B <- Rect[c(1, 2, 5, 7, 9)]
  plot(B, hatch=TRUE)
  plot(Diri, do.col=TRUE)
  plot(Diri, do.col=TRUE, do.labels=TRUE, labelargs=list(col="white"),
             ribbon=FALSE)
  v <- as.im(function(x,y){factor(round(5 * (x^2 + y^2)))}, W=owin())
  levels(v) <- letters[seq(length(levels(v)))]
  Img <- tess(image=v)
  plot(Img)
  plot(Img, col=rainbow(11), ribargs=list(las=1))
  a <- tile.areas(Diri)
  marks(Diri) <- data.frame(area=a, random=runif(7, max=max(a)))
  plot(Diri, do.col=TRUE, equal.ribbon=TRUE)

spatstat.geom documentation built on Sept. 18, 2024, 9:08 a.m.