Learn R Programming

spatstat (version 1.56-1)

plot.layered: Layered Plot

Description

Generates a layered plot. The plot method for objects of class "layered".

Usage

# S3 method for layered
plot(x, ..., which = NULL, plotargs = NULL,
                         add=FALSE, show.all=!add, main=NULL,
                         do.plot=TRUE)

Arguments

x

An object of class "layered" created by the function layered.

Arguments to be passed to the plot method for every layer.

which

Subset index specifying which layers should be plotted.

plotargs

Arguments to be passed to the plot methods for individual layers. A list of lists of arguments of the form name=value.

add

Logical value indicating whether to add the graphics to an existing plot.

show.all

Logical value indicating whether the first layer should be displayed in full (including the main title, bounding window, coordinate axes, colour ribbon, and so on).

main

Main title for the plot

do.plot

Logical value indicating whether to actually do the plotting.

Value

(Invisibly) a list containing the return values from the plot commands for each layer. This list has an attribute "bbox" giving a bounding box for the entire plot.

Details

Layering is a simple mechanism for controlling a high-level plot that is composed of several successive plots, for example, a background and a foreground plot. The layering mechanism makes it easier to plot, to switch on or off the plotting of each individual layer, to control the plotting arguments that are passed to each layer, and to zoom in on a subregion.

The layers of data to be plotted should first be converted into a single object of class "layered" using the function layered. Then the layers can be plotted using the method plot.layered.

To zoom in on a subregion, apply the subset operator [.layered to x before plotting.

Graphics parameters for each layer are determined by (in order of precedence) , plotargs, and layerplotargs(x).

The graphics parameters may also include the special argument .plot specifying (the name of) a function which will be used to perform the plotting instead of the generic plot.

The argument show.all is recognised by many plot methods in spatstat. It determines whether a plot is drawn with all its additional components such as the main title, bounding window, coordinate axes, colour ribbons and legends. The default is TRUE for new plots and FALSE for added plots.

In plot.layered, the argument show.all applies only to the first layer. The subsequent layers are plotted with show.all=FALSE.

To override this, that is, if you really want to draw all the components of all layers of x, insert the argument show.all=TRUE in each entry of plotargs or layerplotargs(x).

See Also

layered, layerplotargs, [.layered, plot.

Examples

Run this code
# NOT RUN {
   data(cells)
   D <- distmap(cells)
   L <- layered(D, cells)
   plot(L)
   plot(L, which = 2)
   plot(L, plotargs=list(list(ribbon=FALSE), list(pch=3, cols="white")))
   # plot a subregion
   plot(L[, square(0.5)])
# }

Run the code above in your browser using DataLab