plot.ppp {spatstat}R Documentation

plot a Spatial Point Pattern

Description

Plot a two-dimensional spatial point pattern

Usage

 plot.ppp(x, main, ..., chars, cols, use.marks=TRUE, add=FALSE, maxsize)

Arguments

x The spatial point pattern to be plotted. An object of class "ppp", or data which can be converted into this format by as.ppp().
main text to be displayed as a title above the plot.
... extra arguments that will be passed to the plotting functions plot.default (see par for possible options) or symbols.
chars the plotting characters which should be used to represent the points of different types, in the case of a multitype point pattern.
cols the colours which should be used to plot the points of different types, in the case of a multitype point pattern.
use.marks logical flag; if TRUE, plot points using a different plotting symbol for each mark; if FALSE, only the locations of the points will be plotted, using points().
add logical flag; if TRUE, just the points are plotted, over the existing plot. A new plot is not created, and the window is not plotted.
maxsize the maximum radius of the circles plotted. If x is a marked point pattern with numerical marks, the marks are plotted as circles with maximum radius maxsize (in the same units as the coordinates of the point pattern). There is a sensible default.

Details

This is the plot method for point pattern datasets (of class "ppp", see ppp.object).

First the observation window x$window is plotted using plot.owin. Then the locations of the points are plotted.

If the points do not have marks (i.e. x$marks is absent) or if use.marks = FALSE, then the locations of the points will be plotted using a single plot character. This character can be changed by the extra argument pch; see the examples.

For a marked point pattern (where x$marks is not null) each point will be represented by a graphical symbol plotted at the location of the point. The graphical representation of the marks depends on their storage mode:

multitype point pattern:
If x$marks is a factor, then each level of the factor is represented by a different plot character.
continuous marks:
If x$marks is a numeric vector, the marks are rescaled to the unit interval and each point is represented by a circle with radius proportional to the rescaled mark (if the value is positive) or a square with side proportional to the absolute value of the rescaled mark (if the value is negative).
otherwise:
Each possible mark will be represented by a different plotting character. The default is to represent the ith smallest mark value by points(..., pch=i).

If the arguments chars and/or cols are supplied, they should be vectors of the same length as sort(unique(x$marks)), and then the ith smallest mark will be plotted using character chars[i] and colour cols[i].

The argument cols is incompatible with the generic plot argument col. If both are given, an error is generated and no plot is produced.

Value

NULL, or a vector giving the correspondence between mark values and plotting characters.

Author(s)

Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner rolf@math.unb.ca http://www.math.unb.ca/~rolf

See Also

ppp.object, plot, par, points, plot.owin, symbols

Examples

   ## Not run: 
   data(cells)
   plot(cells)

   # multitype 
   data(lansing)
   plot(lansing)

   # marked by a real number
   data(longleaf)
   plot(longleaf)

   # just plot the points
   plot(longleaf, use.marks=FALSE)
   plot(unmark(longleaf)) # equivalent

   # controlling COLOURS
   plot(cells, col="blue")
   plot(lansing, cols=c("black", "yellow", "green", "pink",
                        "blue","red","white")
   plot(longleaf, fg="blue")

   # use selected plot characters
   lma <- sort(unique(longleaf$marks))
   adult <- ifelse(lma >= 30, "o", "+")
   plot(longleaf, chars = adult)

   # make the plotting symbols larger (for publication at reduced scale)
   plot(cells, cex=2)

  ## End(Not run)

[Package spatstat version 1.6-4 Index]