zlines: Add Diagonal Lines to Existing Plot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/zlines.R

Description

Adds diagonal lines to a plot, spaced by by x-units. This can be of aid in the interpretion of catch curves. The ‘z’ in zlines refers to total mortality rate, usually denoted Z.

Usage

1
zlines(slope, by=1, ...)

Arguments

slope

slope of diagonal lines sent to argument b in abline.

by

spacing of diagonal lines in x-units.

...

passed to abline.

Value

Invisible vector of intercepts.

Author(s)

Sigurður Þór Jónsson.

See Also

abline is called iteratively to draw the lines.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Any plot, slanting up or down
plot(rnorm(10,10,10), rnorm(10,10,10))
zlines(1)
zlines(1, by=2, col="blue")
zlines(-1, col="red")

## Catch curve
slope <- -0.6
yclasses <- unique(catage$ycl)
mycol <- rainbow(length(yclasses))
tmp <- tapply(catage$ObsCno, list(catage$year,catage$age), sum)
matplot(1980:2009, log(tmp), type="n", ylab="log(catage)", xlab="Year",
        asp=2)
grid(col="grey", lty=2)
zlines(slope=slope, col="grey", lty=2)
for(i in seq(along=yclasses))
{
  tmp <- catage[catage$ycl==yclasses[i],]
  lines(tmp$year, log(tmp$ObsCno), col=mycol[i])
  text(tmp$year, log(tmp$ObsCno), tmp$age, col=mycol[i])
}
text(par("usr")[1]+par("cxy")[1], par("usr")[4]-par("cxy")[2],
     paste("slope =",slope), adj=0)

hafroAssmt documentation built on May 2, 2019, 5:47 p.m.