spec_plot updates/fixes

- update min/max default value
- correct same_lim xlim/ylim calcs
- fix 'polymin' range calcs
- conditionally add 'xpd=NA' everywhere
diff --git a/R/mini_plots.R b/R/mini_plots.R
index 0d264e1..a1463f9 100644
--- a/R/mini_plots.R
+++ b/R/mini_plots.R
@@ -250,9 +250,9 @@
 #' @param polymin Special argument that converts a "line" to a polygon,
 #' where the flat portion is this value, and the other side of the polygon
 #' is the 'y' value ('x' if no 'y' provided). If 'NA' (the default), then
-#' this is ignored, otherwise if this is numeric then a polygon is
-#' created instead (and 'type' is ignored). Note that if 'polymin' is in
-#' the middle of the 'y' values, it will generate up/down polygons.
+#' this is ignored; otherwise if this is numeric then a polygon is
+#' created (and 'type' is ignored). Note that if 'polymin' is in the middle
+#' of the 'y' values, it will generate up/down polygons around this value.
 #' @param minmax,min,max Arguments passed to `points` to highlight minimum
 #' and maximum values in `spec_plot`. If `min` or `max` are `NULL`, they
 #' default to the value of `minmax`. Set to an empty `list()` to disable.
@@ -268,8 +268,8 @@
                       xaxt = 'n', yaxt = 'n', ann = FALSE,
                       col = "lightgray", border = NULL,
                       frame.plot = FALSE, lwd = 2,
-                      pch = ".", cex = 0.1, type = "l", polymin = NA,
-                      minmax = list(pch = ".", cex = lwd, col = "red"),
+                      pch = ".", cex = 2, type = "l", polymin = NA,
+                      minmax = list(pch = ".", cex = cex, col = "red"),
                       min = minmax, max = minmax,
                       dir = if (is_latex()) rmd_files_dir() else tempdir(),
                       file = NULL, file_type = if (is_latex()) "png" else "svg", ...) {
@@ -278,19 +278,16 @@
 
     if (same_lim) {
       if (is.null(xlim)) {
-        xlim <- lapply(x, function(z) base::range(c(z, if (is.null(y)) polymin), na.rm = TRUE))
+        xlim <- base::range(unlist(x), na.rm = TRUE)
       }
       if (is.null(ylim) && !is.null(y)) {
-        if (is.list(y)) {
-          ylim <- lapply(y, function(z) base::range(c(z, polymin), na.rm = TRUE))
-        } else {
-          ylim <- base::range(c(y, polymin), na.rm = TRUE)
-        }
+        ylim <- base::range(c(unlist(y), polymin), na.rm = TRUE)
       }
     }
+
     if (is.null(y)) {
-      y <- replicate(lenx, NULL, simplify = FALSE)
-    } else if (!is.list(y) || lenx != length(y)) {
+      y <- list(y)
+    } else if (length(y) != lenx) {
       stop("'x' and 'y' are not the same length")
     }
 
@@ -352,13 +349,13 @@
     y <- x
     x <- seq_along(y)
     if (!is.null(xlim) && is.null(ylim)) {
-      ylim <- xlim
+      ylim <- range(c(xlim, polymin), na.rm = TRUE)
       xlim <- range(x)
     }
   }
 
   if (is.null(xlim)) {
-    xlim <- base::range(x)
+    xlim <- base::range(x, na.rm = TRUE)
   }
 
   if (is.null(ylim) && !is.null(y)) {
@@ -407,26 +404,26 @@
           c(list(x, y, type = if (is.na(polymin)) type else "n",
                  xlim = xlim, ylim = ylim,
                  xaxt = xaxt, yaxt = yaxt, ann = ann, col = col,
-                 frame.plot = frame.plot, xpd = NA,
-                 cex = cex, pch = pch # in case of type="p" or similar
-                 ), dots))
+                 frame.plot = frame.plot, cex = cex, pch = pch),
+            dots))
 
   if (!is.na(polymin)) {
     lty <- if ("lty" %in% names(dots)) dots$lty else graphics::par("lty")
     polygon(c(x[1], x, x[length(x)]), c(polymin, y, polymin),
-            border = NA, col = col, angle = angle,
-            lty = lty,
-            xpd = NA)
+            border = NA, col = col, angle = angle, lty = lty,
+            xpd = if ("xpd" %in% names(dots)) dots$xpd else NA)
   }
 
   if (!is.null(min) && length(min)) {
+    if (!"xpd" %in% names(min)) min$xpd <- NA
     ind <- which.min(y)
-    do.call(graphics::points, c(list(x[ind], y[ind], xpd = NA), min))
+    do.call(graphics::points, c(list(x[ind], y[ind]), min))
   }
 
   if (!is.null(max) && length(max)) {
+    if (!"xpd" %in% names(max)) max$xpd <- NA
     ind <- which.max(y)
-    do.call(graphics::points, c(list(x[ind], y[ind], xpd = NA), max))
+    do.call(graphics::points, c(list(x[ind], y[ind]), max))
   }
 
   grDevices::dev.off(curdev)