spatstat (version 1.62-2)

plot.linim: Plot Pixel Image on Linear Network

Description

Given a pixel image on a linear network, the pixel values are displayed either as colours or as line widths.

Usage

# S3 method for linim
plot(x, ..., style = c("colour", "width"),
             scale, adjust = 1,
             negative.args = list(col=2),
             legend=TRUE,
             leg.side=c("right", "left", "bottom", "top"),
             leg.sep=0.1,
             leg.wid=0.1,
             leg.args=list(),
             leg.scale=1,
             zlim,
             box=FALSE,
             do.plot=TRUE)

Arguments

x

The pixel image to be plotted. An object of class "linim".

Extra graphical parameters, passed to plot.im if style="colour", or to polygon if style="width".

style

Character string (partially matched) specifying the type of plot. See Details.

scale

Physical scale factor for representing the pixel values as line widths.

adjust

Adjustment factor for the default scale.

negative.args

A list of arguments to be passed to polygon specifying how to plot negative values of x when style="width".

legend

Logical value indicating whether to plot a legend (colour ribbon or scale bar).

leg.side

Character string (partially matched) indicating where to display the legend relative to the main image.

leg.sep

Factor controlling the space between the legend and the image.

leg.wid

Factor controlling the width of the legend.

leg.scale

Rescaling factor for annotations on the legend. The values on the numerical scale printed beside the legend will be multiplied by this rescaling factor.

leg.args

List of additional arguments passed to image.default, axis or text.default to control the display of the legend. These may override the arguments.

zlim

The range of numerical values that should be mapped. A numeric vector of length 2. Defaults to the range of values of x.

box

Logical value indicating whether to draw a bounding box.

do.plot

Logical value indicating whether to actually perform the plot.

Value

If style="colour", the result is an object of class "colourmap" specifying the colour map used. If style="width", the result is a numeric value v giving the physical scale: one unit of pixel value is represented as v physical units on the plot.

The result also has an attribute "bbox" giving a bounding box for the plot. The bounding box includes the ribbon or scale bar, if present, but not the main title.

Details

This is the plot method for objects of class "linim". Such an object represents a pixel image defined on a linear network.

If style="colour" (the default) then the pixel values of x are plotted as colours, using plot.im. The mapping from pixel values to colours is determined by any additional arguments which are passed to plot.im.

If style="width" then the pixel values of x are used to determine the widths of thick lines centred on the line segments of the linear network. The mapping from pixel values to line widths is determined by the arguments scale and adjust. The plotting of colours and borders of the lines is controlled by the additional arguments which are passed to polygon. A different set of colours and borders can be assigned to negative pixel values by passing a list of arguments in negative.args as shown in the Examples.

A legend is displayed alongside the plot if legend=TRUE (the default). The legend displays the relationship between pixel values and colours (if style="colour") or between pixel values and line widths (if style="width").

The plotting of the legend itself is controlled by the arguments leg.side, leg.sep, leg.wid, leg.scale and the list of arguments leg.args, which are described above. If style="colour", these arguments are mapped to the arguments ribside, ribsep, ribwid, ribscale and ribargs respectively, which are passed to plot.im.

References

Ang, Q.W., Baddeley, A. and Nair, G. (2012) Geometrically corrected second-order analysis of events on a linear network, with applications to ecology and criminology. Scandinavian Journal of Statistics 39, 591--617.

See Also

linim, plot.im, polygon

Examples

Run this code
# NOT RUN {
  X <- linfun(function(x,y,seg,tp){y^2+x}, simplenet)
  X <- as.linim(X)
  
  plot(X)
  plot(X, style="width", main="Width proportional to function value")

  # signed values
  f <- linfun(function(x,y,seg,tp){y-x}, simplenet)
  plot(f, style="w", main="Negative values in red")

  plot(f, style="w", negative.args=list(density=10),
       main="Negative values are hatched")
# }

Run the code above in your browser using DataCamp Workspace