plot.yardstick: Plot a Yardstick or Scale Bar

plot.yardstickR Documentation

Plot a Yardstick or Scale Bar

Description

Plots an object of class "yardstick".

Usage

 ## S3 method for class 'yardstick'
plot(x, ...,
        angle = 20, frac = 1/8, 
        split = FALSE, shrink = 1/4,
        pos = NULL,
        txt.args=list(),
        txt.shift=c(0,0),
        do.plot = TRUE)

Arguments

x

Object of class "yardstick" to be plotted. This object is created by the command yardstick.

...

Additional graphics arguments passed to segments to control the appearance of the line.

angle

Angle between the arrows and the line segment, in degrees.

frac

Length of arrow as a fraction of total length of the line segment.

split

Logical. If TRUE, then the line will be broken in the middle, and the text will be placed in this gap. If FALSE, the line will be unbroken, and the text will be placed beside the line.

shrink

Fraction of total length to be removed from the middle of the line segment, if split=TRUE.

pos

Integer (passed to text) determining the position of the annotation text relative to the line segment, if split=FALSE. Values of 1, 2, 3 and 4 indicate positions below, to the left of, above and to the right of the line, respectively.

txt.args

Optional list of additional arguments passed to text controlling the appearance of the text. Examples include adj, srt, col, cex, font.

txt.shift

Optional numeric vector of length 2 specifying displacement of the text position relative to the centre of the yardstick.

do.plot

Logical. Whether to actually perform the plot (do.plot=TRUE).

Details

A yardstick or scale bar is a line segment, drawn on any spatial graphics display, indicating the scale of the plot.

The argument x should be an object of class "yardstick" created by the command yardstick.

Value

A window (class "owin") enclosing the plotted graphics.

Author(s)

\adrian \rolf

and \ege

See Also

yardstick

Examples

  plot(owin(), main="Yardsticks")
  ys <- yardstick(as.psp(list(xmid=0.5, ymid=0.1, length=0.4, angle=0),
                         window=owin(c(0.2, 0.8), c(0, 0.2))),
                  txt="1 km")
  plot(ys)
  ys <- shift(ys, c(0, 0.3))
  plot(ys, angle=90, frac=0.08)
  ys <- shift(ys, c(0, 0.3))
  plot(ys, split=TRUE)

spatstat.geom documentation built on Sept. 18, 2024, 9:08 a.m.