Learn R Programming

spatstat (version 1.23-1)

plot.psp: plot a Spatial Line Segment Pattern

Description

Plot a two-dimensional line segment pattern

Usage

## S3 method for class 'psp':
plot(x, \dots, add=FALSE, which.marks=1,
                     ribbon=TRUE, ribsep=0.15, ribwid=0.05, ribn=1024)

Arguments

x
The line segment pattern to be plotted. An object of class "psp", or data which can be converted into this format by as.psp().
...
extra arguments that will be passed to the plotting functions segments (to plot the segments) and plot.owin (to plot the observation window).
add
Logical. If TRUE, the current plot is not erased; the segments are plotted on top of the current plot, and the window is not plotted.
which.marks
Index determining which column of marks to use, if the marks of x are a data frame. A character string or an integer. Defaults to 1 indicating the first column of marks.
ribbon
Logical flag indicating whether to display a ribbon showing the colour map (in which mark values are associated with colours).
ribsep
Factor controlling the space between the ribbon and the image.
ribwid
Factor controlling the width of the ribbon.
ribn
Number of different values to display in the ribbon.

Value

  • NULL

Details

This is the plot method for line segment pattern datasets (of class "psp", see psp.object). It plots both the observation window x$window and the line segments themselves. Plotting of the window x$window is performed by plot.owin. This plot may be modified through the ... arguments.

Plotting of the segments themselves is performed by the standard R function segments. Its plotting behaviour may also be modified through the ... arguments.

For a marked line segment pattern (i.e. if marks(x) is not NULL) the line segments are plotted in colours determined by the mark values. If marks(x) is a data frame, the default is to use the first column of marks(x) to determine the colours. To specify another column, use the argument which.marks. The colour map (associating mark values with colours) will be displayed as a vertical colour ribbon to the right of the plot, if ribbon=TRUE.

See Also

psp.object, plot, par, plot.owin, symbols

Examples

Run this code
X <- psp(runif(20), runif(20), runif(20), runif(20), window=owin())
  plot(X)
  plot(X, lwd=3)
  lettuce <- sample(letters[1:4], 20, replace=TRUE)
  marks(X) <- data.frame(A=1:20, B=factor(lettuce))
  plot(X)
  plot(X, which.marks="B")

Run the code above in your browser using DataLab