From b4491fce1f51614b4800311752d7b232b44b9db0 Mon Sep 17 00:00:00 2001 From: dankelley Date: Mon, 20 Jan 2025 11:00:17 -0400 Subject: [PATCH] oce.plot.ts() obeys 'xlab' (issue 2285) --- NEWS.md | 1 + R/oce.R | 6 ++---- man/oce.plot.ts.Rd | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 77acf1091..0965489a9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,6 +21,7 @@ * Change `mapPlot()` to handle `las` as a parameter (issue #1707). * Change `oce.plot.ts()` to handle `grid` better (issue #2267). * Change `oce.plot.ts()` to handle `simplify` better (issue #2277). +* Change `oce.plot.ts()` to handle `xlab` (issue #2285). * Change `plot.section()` to handle `eos="gsw"` (issue #2256). * Change `read.amsr()` to handle realtime data files (issue #2230). * Change `read.ctd.sbe()` to handle files that lack salinity and conductivity (issues #2279 and #2282). diff --git a/R/oce.R b/R/oce.R index 855decb34..08d630949 100644 --- a/R/oce.R +++ b/R/oce.R @@ -1144,7 +1144,7 @@ oce.grid <- function(xat, yat, col = "lightgray", lty = "dotted", lwd = par("lwd #' # Flip the y axis #' oce.plot.ts(t, y, flipy = TRUE) oce.plot.ts <- function( - x, y, type = "l", xlim, ylim, log = "", logStyle = "r", flipy = FALSE, xlab, ylab, + x, y, type = "l", xlim, ylim, log = "", logStyle = "r", flipy = FALSE, xlab = "", ylab, drawTimeRange, simplify = 2560, fill = FALSE, col = par("col"), pch = par("pch"), cex = par("cex"), cex.axis = par("cex.axis"), cex.lab = par("cex.lab"), cex.main = par("cex.main"), xaxs = par("xaxs"), yaxs = par("yaxs"), @@ -1163,9 +1163,6 @@ oce.plot.ts <- function( if (!inherits(x, "POSIXt")) { x <- as.POSIXct(x) } - if (missing(xlab)) { - xlab <- "" - } if (missing(ylab)) { ylab <- deparse(substitute(expr = y, env = environment())) } @@ -1382,6 +1379,7 @@ oce.plot.ts <- function( type = type, col = col, cex = cex, cex.axis = cex.axis, cex.lab = cex.lab, pch = pch, log = log, ... ) # mtext(paste("TEST: xlab at mgp[1]", xlab), side=1, cex=cex.lab*par("cex"), line=mgp[1]) + mtext(xlab, side = 1, cex = cex.lab * par("cex"), line = mgp[1]) mtext(ylab, side = 2, cex = cex.lab * par("cex"), line = mgp[1]) } xat <- NULL diff --git a/man/oce.plot.ts.Rd b/man/oce.plot.ts.Rd index c4dc5caaa..f0158f953 100644 --- a/man/oce.plot.ts.Rd +++ b/man/oce.plot.ts.Rd @@ -13,7 +13,7 @@ oce.plot.ts( log = "", logStyle = "r", flipy = FALSE, - xlab, + xlab = "", ylab, drawTimeRange, simplify = 2560,