plot.yardstick {spatstat.geom} | R Documentation |
Plot a Yardstick or Scale Bar
Description
Plots an object of class "yardstick"
.
Usage
## S3 method for class 'yardstick'
plot(x, ...,
style=c("arrows", "zebra"),
angle = 20, frac = 1/8,
split = FALSE, shrink = 1/4,
pos = NULL,
txt.args=list(),
txt.shift=c(0,0),
zebra.step=NULL, zebra.width=NULL,
zebra.col="black", zebra.scale=1,
zebra.args=list(), zebra.shift=c(0,0),
do.plot = TRUE, do.txt=TRUE)
Arguments
x |
Object of class |
... |
Additional graphics arguments passed to
|
style |
Character string (partially matched) specifying the style of plot. See Details. |
angle |
Angle between the arrows and the line segment, in degrees.
Applies when |
frac |
Length of arrow as a fraction of total length of the line segment.
Applies when |
split |
Logical. If |
shrink |
Fraction of total length to be removed from the middle of the
line segment, if |
pos |
Integer (passed to |
txt.args |
Optional list of additional arguments passed to
|
txt.shift |
Optional numeric vector of length 2 specifying displacement of the text position relative to the centre of the yardstick. |
zebra.step |
Length of each bar in the zebra pattern.
Applies when |
zebra.width |
Width of each bar in the zebra pattern.
Applies when |
zebra.col |
Colour of each bar in the zebra pattern.
Applies when |
zebra.scale |
Scale value for numerical labels in the zebra pattern.
Physical lengths will be divided by |
zebra.args |
Optional list of additional arguments passed to
|
zebra.shift |
Optional numeric vector of length 2 specifying displacement of the text annotation for each bar in the zebra pattern. |
do.plot |
Logical values specifying whether to actually perform the plot. |
do.txt |
Logical value specifying whether to draw text annotation. |
Details
A yardstick or scale bar is a line segment, drawn on any spatial graphics display, indicating the scale of the plot.
If
style="arrows"
, the line segment is drawn as a pair of arrows pointing from the middle of the line to the ends of the line. This style is often used in architectural drawings. Ifangle=0
, the arrow heads are replaced by parallel bars marking the two ends of the line.If
style="zebra"
, the line segment is divided into block of lengthzebra.step
and widthzebra.width
units. Blocks are drawn alternately as filled rectangles and outlined rectangles, so that the result resembles a zebra crossing. This style is often used in maps and charts. There are sensible defaults forzebra.step
andzebra.width
.
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 Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.
See Also
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)
yt <- shift(ys, c(0, 0.2))
plot(yt, style="z", pos=3, zebra.step=0.1, txt.args=list(offset=0.1))