Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pairs.im

Scatterplot Matrix for Pixel Images


Description

Produces a scatterplot matrix of the pixel values in two or more pixel images.

Usage

## S3 method for class 'im'
pairs(..., plot=TRUE, drop=TRUE)

Arguments

...

Any number of arguments, each of which is either a pixel image (object of class "im") or a named argument to be passed to pairs.default.

plot

Logical. If TRUE, the scatterplot matrix is plotted.

drop

Logical value specifying whether pixel values that are NA should be removed from the data frame that is returned by the function. This does not affect the plot.

Details

This is a method for the generic function pairs for the class of pixel images.

It produces a square array of plot panels, in which each panel shows a scatterplot of the pixel values of one image against the corresponding pixel values of another image.

At least two of the arguments ... should be pixel images (objects of class "im"). Their spatial domains must overlap, but need not have the same pixel dimensions.

First the pixel image domains are intersected, and converted to a common pixel resolution. Then the corresponding pixel values of each image are extracted. Then pairs.default is called to plot the scatterplot matrix.

Any arguments in ... which are not pixel images will be passed to pairs.default to control the plot.

The return value of pairs.im is a data frame, returned invisibly. The data frame has one column for each image. Each row contains the pixel values of the different images for one pixel in the raster. If drop=TRUE (the default), any row which contains NA is deleted. The plot is not affected by the value of drop.

Value

Invisible. A data.frame containing the corresponding pixel values for each image. The return value also belongs to the class plotpairsim which has a plot method, so that it can be re-plotted.

Image or Contour Plots

Since the scatterplots may show very dense concentrations of points, it may be useful to set panel=panel.image or panel=panel.contour to draw a colour image or contour plot of the kernel-smoothed density of the scatterplot in each panel. The argument panel is passed to pairs.default. See the help for panel.image and panel.contour.

Low Level Control of Graphics

To control the appearance of the individual scatterplot panels, see pairs.default, points or par. To control the plotting symbol for the points in the scatterplot, use the arguments pch, col, bg as described under points (because the default panel plotter is the function points). To suppress the tick marks on the plot axes, type par(xaxt="n", yaxt="n") before calling pairs.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

X <- density(rpoispp(30))
  Y <- density(rpoispp(40))
  Z <- density(rpoispp(30))
  p <- pairs(X,Y,Z)
  p
  plot(p)

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.