Learn R Programming

spatstat (version 1.56-1)

plot.hyperframe: Plot Entries in a Hyperframe

Description

Plots the entries in a hyperframe, in a series of panels, one panel for each row of the hyperframe.

Usage

# S3 method for hyperframe
plot(x, e, …, main, arrange=TRUE,
                            nrows=NULL, ncols=NULL,
                            parargs=list(mar=mar * marsize),
                            marsize=1, mar=c(1,1,3,1))

Arguments

x

Data to be plotted. A hyperframe (object of class "hyperframe", see hyperframe).

e

How to plot each row. Optional. An R language call or expression (typically enclosed in quote() that will be evaluated in each row of the hyperframe to generate the plots.

Extra arguments controlling the plot (when e is missing).

main

Overall title for the array of plots.

arrange

Logical flag indicating whether to plot the objects side-by-side on a single page (arrange=TRUE) or plot them individually in a succession of frames (arrange=FALSE).

nrows,ncols

Optional. The number of rows/columns in the plot layout (assuming arrange=TRUE). You can specify either or both of these numbers.

parargs

Optional list of arguments passed to par before plotting each panel. Can be used to control margin sizes, etc.

marsize

Optional scale parameter controlling the sizes of margins around the panels. Incompatible with parargs.

mar

Optional numeric vector of length 1, 2 or 4 controlling the relative sizes of margins between the panels. Incompatible with parargs.

Value

NULL.

Details

This is the plot method for the class "hyperframe".

The argument x must be a hyperframe (like a data frame, except that the entries can be objects of any class; see hyperframe).

This function generates a series of plots, one plot for each row of the hyperframe. If arrange=TRUE (the default), then these plots are arranged in a neat array of panels within a single plot frame. If arrange=FALSE, the plots are simply executed one after another.

Exactly what is plotted, and how it is plotted, depends on the argument e. The default (if e is missing) is to plot only the first column of x. Each entry in the first column is plotted using the generic plot command, together with any extra arguments given in .

If e is present, it should be an R language expression involving the column names of x. (It is typically created using quote or expression.) The expression will be evaluated once for each row of x. It will be evaluated in an environment where each column name of x is interpreted as meaning the object in that column in the current row. See the Examples.

See Also

hyperframe, with.hyperframe

Examples

Run this code
# NOT RUN {
   H <- hyperframe(id=1:10)
   H$X <- with(H, rpoispp(100))
   H$D <- with(H, distmap(X))
   # points only
   plot(H[,"X"])
   plot(H, quote(plot(X, main=id)))
   # points superimposed on images
   plot(H, quote({plot(D, main=id); plot(X, add=TRUE)}))
# }

Run the code above in your browser using DataLab