plot.layered | R Documentation |
Generates a layered plot.
The plot method for objects of class "layered"
.
## S3 method for class 'layered'
plot(x, ..., which = NULL, plotargs = NULL,
add=FALSE, show.all=!add, main=NULL,
do.plot=TRUE)
x |
An object of class |
... |
Arguments to be passed to the |
which |
Subset index specifying which layers should be plotted. |
plotargs |
Arguments to be passed to the |
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. |
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)
.
(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.
and \rolf
layered
,
layerplotargs
,
[.layered
,
plot
.
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)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.