From e75821b2ccbb31d23ea6cf02109cf67eb2eeb90d Mon Sep 17 00:00:00 2001 From: MOshima-PIFSC Date: Wed, 6 Aug 2025 16:23:44 -1000 Subject: [PATCH 1/2] fix legend color mismatch for runstest --- R/SSplotRunstest.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/SSplotRunstest.R b/R/SSplotRunstest.R index 8a49c20..38cb112 100644 --- a/R/SSplotRunstest.R +++ b/R/SSplotRunstest.R @@ -186,6 +186,9 @@ SSplotRunstest <- function(ss3rep, subplots <- subplots[1] datatypes <- c("Index", "Mean length", "Mean age", "Conditional age-at-length") ylabel <- datatypes[which(c("cpue", "len", "age", "con") %in% subplots)] + if(length(ylabel) == 0){ + stop(subplots, "is not a valid type. Please choose from the options cpue, len, age, size, or con") + } if (verbose) message("Running Runs Test Diagnostics w/ plots for", datatypes[which(c("cpue", "len", "age", "con") %in% subplots)]) if (subplots == "cpue") { cpue <- ss3rep[["cpue"]] @@ -328,7 +331,7 @@ SSplotRunstest <- function(ss3rep, points(resid[["Time"]], resid[["residuals"]], pch = pch, bg = point_cols, cex = 1) if (legend) { legend(legendloc, paste(resid[["Fleet_name"]][1]), bty = "n", y.intersp = -0.2, cex = legendcex + 0.1) - legend("topright", legend = c(point_labels, "sigma3 limit"), pch = c(rep(21, n_point_cols), 22), pt.bg = c(unique(point_cols), cols)) + legend("topright", legend = c(point_labels, "sigma3 limit"), pch = c(rep(21, n_point_cols), 22), pt.bg = c(sort(unique(point_cols)), cols)) } axis(1, at = resid[["Yr"]]) From 86f6045244eff0b17f0b87ce68a3d7cf0498570d Mon Sep 17 00:00:00 2001 From: MOshima-PIFSC <78562167+MOshima-PIFSC@users.noreply.github.com> Date: Thu, 7 Aug 2025 02:34:54 +0000 Subject: [PATCH 2/2] style and docs: run devtools::document() and styler::style_pkg() --- R/SSplotRunstest.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/SSplotRunstest.R b/R/SSplotRunstest.R index 38cb112..776c5c8 100644 --- a/R/SSplotRunstest.R +++ b/R/SSplotRunstest.R @@ -186,7 +186,7 @@ SSplotRunstest <- function(ss3rep, subplots <- subplots[1] datatypes <- c("Index", "Mean length", "Mean age", "Conditional age-at-length") ylabel <- datatypes[which(c("cpue", "len", "age", "con") %in% subplots)] - if(length(ylabel) == 0){ + if (length(ylabel) == 0) { stop(subplots, "is not a valid type. Please choose from the options cpue, len, age, size, or con") } if (verbose) message("Running Runs Test Diagnostics w/ plots for", datatypes[which(c("cpue", "len", "age", "con") %in% subplots)])