Skip to content

Commit

Permalink
improvements to plot.optimalSpacing
Browse files Browse the repository at this point in the history
  • Loading branch information
MurrayEfford committed Apr 29, 2024
1 parent 1e85141 commit 14fed81
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Changes in version 2.9.2 (2024-04-29)
Changes in version 2.9.2 (2024-04-30)

New features or changed behaviour of old functions
o none
Expand All @@ -8,7 +8,7 @@ Bugs fixed

Other
o internal function dfcast accepts character detectfn
o plot.optimalSpacing tweaked to allow pch other than 1
o plot.optimalSpacing tweaked to allow pch other than 1 and new plottype option

Changes in version 2.9.1 (2024-04-20)

Expand Down
12 changes: 7 additions & 5 deletions R/optimalSpacing.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ optimalSpacing <- function (
}
##############################################################################

plot.optimalSpacing <- function (x, add = FALSE, plottype = c("RSE", "nrm"), ...) {
plot.optimalSpacing <- function (x, add = FALSE, plottype = c("both", "RSE", "nrm"), ...) {
## need to define missing cases
args <- list(...)
plottype <- match.arg(plottype)
Expand Down Expand Up @@ -300,14 +300,16 @@ plot.optimalSpacing <- function (x, add = FALSE, plottype = c("RSE", "nrm"), ...
do.call(plot, plotargs)
}

if (plottype == "RSE") {
if (plottype %in% c("both","RSE")) {
defaultargs <- list(col = "black", lwd = 1, cex = 1, pch = 21)
dotsargs <- args[names(args) %in% c("col", "lwd", "lty", "cex", "pch", "bg")]
plotargs <- replacedefaults(defaultargs, dotsargs)

plotargs$x <- R
plotargs$y <- y
do.call(lines, plotargs)
if (plottype == "both") {
plotargs$x <- R
plotargs$y <- y
do.call(lines, plotargs)
}

# suspend this 2018-11-30
# if (!is.null(x$rotRSE$optimum.R)) {
Expand Down
4 changes: 2 additions & 2 deletions man/plot.optimalSpacing.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Plotsor print results from optimalSpacing.

\usage{

\method{plot}{optimalSpacing}(x, add = FALSE, plottype = c("RSE", "nrm"), ...)
\method{plot}{optimalSpacing}(x, add = FALSE, plottype = c("both", "RSE", "nrm"), ...)
\method{print}{optimalSpacing}(x, ...)

}
Expand All @@ -26,7 +26,7 @@ Plotsor print results from optimalSpacing.

\details{

If \code{type = "RSE"} then RSE(D-hat) is plotted against R (relative detector spacing), otherwise the expected numbers of individuals, recaptures and movements are plotted against R.
If \code{plottype = "RSE"} then RSE(D-hat) is plotted against R (relative detector spacing). If \code{plottype = "nrm"} then the expected numbers of individuals, recaptures and movements are plotted against R.

The \dots argument may be used to pass other plotting arguments to override defaults:

Expand Down

0 comments on commit 14fed81

Please sign in to comment.