From e139016a28fcabfd5942718d57499b5cf4242119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20G=2E=20Barna?= Date: Tue, 23 May 2017 14:36:21 +0200 Subject: [PATCH 1/2] Fixed handling non-finite values in colorBin arg domain. --- R/colors.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/colors.R b/R/colors.R index 4767a59ea..d287ed25c 100644 --- a/R/colors.R +++ b/R/colors.R @@ -112,6 +112,8 @@ colorBin <- function(palette, domain, bins = 7, pretty = TRUE, # breaks are specified if (missing(domain) && length(bins) > 1) { domain = NULL + } else if (!(length(domain) == 2 && all(is.finite(domain)))) { + stop ("'Domain' must be of length 2 and contain finite values only!") } autobin = is.null(domain) && length(bins) == 1 if (!is.null(domain)) From d065edc12487717055835c2abe486aff5a8dbdf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20G=2E=20Barna?= Date: Tue, 23 May 2017 15:52:59 +0200 Subject: [PATCH 2/2] Removed length restriction of domain in colorBin. --- R/colors.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/colors.R b/R/colors.R index d287ed25c..5c14603ec 100644 --- a/R/colors.R +++ b/R/colors.R @@ -112,8 +112,8 @@ colorBin <- function(palette, domain, bins = 7, pretty = TRUE, # breaks are specified if (missing(domain) && length(bins) > 1) { domain = NULL - } else if (!(length(domain) == 2 && all(is.finite(domain)))) { - stop ("'Domain' must be of length 2 and contain finite values only!") + } else if (!( table(is.finite(domain))["TRUE"] > 1 )) { + stop ("'Domain' must contain at least 2 finite values!") } autobin = is.null(domain) && length(bins) == 1 if (!is.null(domain))