Skip to content

Commit

Permalink
auto-set x/ylab names from data names
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks committed Jul 31, 2024
1 parent fbcf0f8 commit acf8a28
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions R/plot_aagi.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ plot_aagi <- function(x,
sub = NULL,
xlab = NULL,
ylab = NULL,

col = "AAGI Black",
pch = 16,
...) {
Expand All @@ -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)])
Expand Down

0 comments on commit acf8a28

Please sign in to comment.