Skip to content

Commit 877348e

Browse files
authored
Merge pull request #184 from hugomflavio/issue_183
closes 183
2 parents 144ca6d + 69a87ea commit 877348e

5 files changed

Lines changed: 31 additions & 8 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: actel
22
Title: Acoustic Telemetry Data Analysis
3-
Version: 1.3.0.9023
3+
Version: 1.3.0.9024
44
Authors@R: c(
55
person("Hugo", "Flávio", role = c("aut", "cre"),
66
email = "hflavio@dal.ca", comment = c(ORCID = "0000-0002-5174-1197")),

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Enhancements:
4040
* Improved the inner mechanics of `extractSignals()` and `extractCodeSpaces()` so they're much faster now.
4141
* New arguments `back.warning` and `back.error` included to `migration()` to give users more control over warnings and user interaction prompts.
4242
* New column "Last.section" in `status.df`.
43+
* New argument `y.order` for function `plotDetections()` following user request (issue [#183](https://github.com/hugomflavio/actel/issues/183)).
4344

4445
## actel 1.3.0
4546

R/helper.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,9 @@ event <- function(..., type, tag) {
542542
}
543543
type <- tolower(type)
544544

545-
if ("warning" %in% type & "error" %in% type) { # nocov start
545+
if ("warning" %in% type & "stop" %in% type) { # nocov start
546546
# this should never happen, this is a dev error
547-
stop("event() was called with both warning and error flags.",
547+
stop("event() was called with both warning and stop flags.",
548548
call. = FALSE)
549549
} # nocov end
550550

R/plot.R

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ plotMoves <- function(input, tags, title, xlab, ylab, col, array.alias, show.rel
776776
#' @param tag The transmitter to be plotted.
777777
#' @param type DEPRECATED. Please use the argument y.axis instead.
778778
#' @param y.axis The type of y axis desired. One of "stations" (default) or "arrays".
779+
#' @param y.order A vector with the desired order for the y-axis values.
779780
#' @param title An optional title for the plot. If left empty, a default title will be added.
780781
#' @param xlab,ylab Optional axis names for the plot. If left empty, default axis names will be added.
781782
#' @param col An optional colour scheme for the detections. If left empty, default colours will be added.
@@ -810,8 +811,8 @@ plotMoves <- function(input, tags, title, xlab, ylab, col, array.alias, show.rel
810811
#' @export
811812
#'
812813
plotDetections <- function(input, tag, type,
813-
y.axis = c("auto", "stations", "arrays"), title,
814-
xlab, ylab, col, array.alias, section.alias,
814+
y.axis = c("auto", "stations", "arrays"), y.order,
815+
title, xlab, ylab, col, array.alias, section.alias,
815816
frame.warning = TRUE, x.label.format,
816817
only.valid = FALSE, like.migration = TRUE) {
817818
# NOTE: The NULL variables below are actually column names used by ggplot.
@@ -975,12 +976,30 @@ plotDetections <- function(input, tag, type,
975976
names(link) <- 1:length(link)
976977
link <- sort(link)
977978
link <- as.numeric(names(link))
978-
y.order <- spatial$stations$Standard.name[link]
979+
tmp.y.order <- spatial$stations$Standard.name[link]
979980
} else {
980981
if (any(detections$Array == "Unknown")) {
981-
y.order <- c(array.order$Array, "Unknown")
982+
tmp.y.order <- c(array.order$Array, "Unknown")
982983
} else {
983-
y.order <- array.order$Array
984+
tmp.y.order <- array.order$Array
985+
}
986+
}
987+
988+
if (missing("y.order")) {
989+
y.order <- tmp.y.order
990+
} else {
991+
check <- !tmp.y.order %in% y.order
992+
if (any(check)) {
993+
stop("y.order argument is missing the following required values: ",
994+
paste(tmp.y.order[check], collapse = ", "),
995+
call. = FALSE)
996+
}
997+
check <- !y.order %in% tmp.y.order
998+
if (any(check)) {
999+
warning("y.order argument has values that will not be used: ",
1000+
paste(y.order[check], collapse = ", "),
1001+
call. = FALSE, immediate. = TRUE)
1002+
y.order <- y.order[!check]
9841003
}
9851004
}
9861005

man/plotDetections.Rd

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)