From acf8a28b3f1e554f697200a37518869068078b55 Mon Sep 17 00:00:00 2001 From: "Adam H. Sparks" Date: Wed, 31 Jul 2024 16:15:29 +0800 Subject: [PATCH] auto-set x/ylab names from data names --- R/plot_aagi.R | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/R/plot_aagi.R b/R/plot_aagi.R index bb3d6e5..93b4f0e 100644 --- a/R/plot_aagi.R +++ b/R/plot_aagi.R @@ -75,7 +75,6 @@ plot_aagi <- function(x, sub = NULL, xlab = NULL, ylab = NULL, - col = "AAGI Black", pch = 16, ...) { @@ -84,16 +83,18 @@ plot_aagi <- function(x, # validation/matching is done in {AAGIPalettes} so not needed here col <- AAGIPalettes::colour_as_hex(col) } - if (missing(xlab)) { - xlab <- "" - } - if (missing(ylab)) { - ylab <- "" - } # set new pars withr::local_par(.new = par_aagi()) + if (is.null(xlab)) { + xlab <- names(x[1]) + } + + if (is.null(ylab)) { + ylab <- names(x[2]) + } + xy <- grDevices::xy.coords(x, y) if (is.null(xlim)) { xlimit <- range(xy$x[is.finite(xy$x)])