Learn R Programming

spatstat.linnet (version 3.4-1)

persp.linim: Perspective View of Pixel Image on a Linear Network

Description

Given a pixel image on a linear network, generate a perspective view.

Usage

# S3 method for linim
persp(x, ..., main,
                       grid = TRUE, ngrid = 10,
                       col.grid = "grey", col.base = "white",
                       neg.args=list(), warncross=FALSE,
                       zadjust=1,
                       extrapolate=c("linear", "constant"))

Value

(Invisibly) the perspective transformation matrix, as described in the help for persp.default.

Arguments

x

Pixel image on a linear network (object of class "linim").

...

Arguments passed to persp.default to control the perspective view, or passed to segments or polygon to control the appearance of the vertical panes.

main

Main title for the plot.

grid

Logical value indicating whether to draw a rectangular grid on the base plane (at height zero), to assist the perception of perspective.

ngrid

Number of grid lines to draw, if grid=TRUE.

col.grid

Colour of grid lines, if grid=TRUE.

col.base

Colour of base plane. A single colour value, or a pixel image.

neg.args

Optional list of arguments passed to polygon when displaying negative values of the function.

warncross

Logical value indicating whether to issue a warning if two segments of the network cross each other (which causes difficulty for the algorithm).

zadjust

Adjustment factor for vertical scale, relative to the default scale.

extrapolate

Character string (partially matched) specifying how to extrapolate the value at the endpoint of each segment.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Greg McSwiggan.

Details

The pixel values are interpreted as the spatially-varying height of a vertical surface erected on each segment of the linear network. These surfaces are drawn in perspective view. This style of plot is often attributed to Okabe and Sugihara (2012).

  1. The horizontal plane at height zero is drawn, in perspective view, in the colour specified by col.base.

    If col.base is a pixel image, it will be rendered as a colour image shown in perspective view on the horizontal plane. The argument colmap controls the mapping from pixel values of col.base to physical colours.

  2. A grid of lines on the horizontal plane is drawn if grid=TRUE (the default).

  3. For each segment of the network, a vertical polygon is constructed, with a straight lower edge aligned with the network segment, and a crooked upper edge whose height is proportional to values of x. The polygon linearly interpolates between the values of pixels that lie along the segment. At each end of the segment,

    • If extrapolate="linear" (the default), the polygon height at the end of the segment is determined by linearly extrapolating from the two nearest pixel values.

    • If extrapolate="constant", the polygon height at the end of the segment is defined to be equal to the nearest pixel value.

    The vertical polygons are drawn in the colour and style specified by the additional arguments ..., for example, col for colour.

If x contains negative values, they will be represented as polygons extending downwards below the horizontal plane. These would be obscured if col.base is an opaque colour other than white, or if col.base is a pixel image. A transparent colour for col.base can be used if it is supported by the graphics device.

Like all spatial plots in the spatstat family, persp.linim does not independently rescale the \(x\) and \(y\) coordinates. A long narrow window will be represented as a long narrow window in the perspective view. To override this and allow the coordinates to be independently rescaled, use the argument scale=TRUE which will be passed to persp.default.

References

Okabe, A. and Sugihara, K. (2012) Spatial Analysis Along Networks. John Wiley and Sons, New York.

See Also

persp.linfun

Examples

Run this code
  if(interactive()) {
    Z <- density(chicago, 100)
  } else {
    X <- runiflpp(10, simplenet)
    Z <- density(X, 0.1)
  }
  persp(Z, theta=30, phi=20)

Run the code above in your browser using DataLab