diff --git a/R/PlotEquiMap.R b/R/PlotEquiMap.R index 3b8f861f8b7dced6b9ddcba7b99b202717e59da9..a2a7e3d4328285bb69e9d45a839107b683221e38 100644 --- a/R/PlotEquiMap.R +++ b/R/PlotEquiMap.R @@ -531,7 +531,8 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, } if (!all(is.na(var))) { - var_limits <- c(min(var, na.rm = TRUE), max(var, na.rm = TRUE)) + var_limits <- c(min(var[!is.infinite(var)], na.rm = TRUE), + max(var[!is.infinite(var)], na.rm = TRUE)) } else { .warning("All the data are NAs. The map will be filled with colNA.") if (!is.null(brks) && length(brks) > 1) { diff --git a/R/PlotLayout.R b/R/PlotLayout.R index 6553f8a5067a85d83619bbcacfc16411c29aabd5..c77b25a405d3b40535606870899711ad0cda77bd 100644 --- a/R/PlotLayout.R +++ b/R/PlotLayout.R @@ -348,7 +348,9 @@ PlotLayout <- function(fun, plot_dims, var, ..., special_args = NULL, # Check the rest of parameters (unless the user simply wants to build an empty layout) if (!all(sapply(var, is_single_na))) { if (!all(is.na(unlist(var)))) { - var_limits <- c(min(unlist(var), na.rm = TRUE), max(unlist(var), na.rm = TRUE)) + tmp <- !is.infinite(unlist(var)) + var_limits <- c(min(unlist(var)[tmp], na.rm = TRUE), + max(unlist(var)[tmp], na.rm = TRUE)) } else { if (!is.null(brks)) { #NOTE: var_limits be like this to avoid warnings from ColorBar