From f916c7ed2756989ccd3a927b48c75f6147816990 Mon Sep 17 00:00:00 2001 From: mtennekes Date: Mon, 5 Aug 2024 18:55:45 +0200 Subject: [PATCH] rgb with na values fixed (#910) --- R/tmapScaleRGB.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tmapScaleRGB.R b/R/tmapScaleRGB.R index cce23fc7..f55c9d3f 100644 --- a/R/tmapScaleRGB.R +++ b/R/tmapScaleRGB.R @@ -24,7 +24,7 @@ tmapScaleRGB_RGBA = function(xlist, scale, legend, chart, o, aes, layer, layer_a if (any(isna)) { values = rep(scale$value.na, n) - values[!isna] = do.call(grDevices::rgb, c(xlist, list(maxColorValue = scale$maxValue))) + values[!isna] = do.call(grDevices::rgb, c(lapply(xlist, function(xl) xl[!isna]), list(maxColorValue = scale$maxValue))) } else { values = do.call(grDevices::rgb, c(xlist, list(maxColorValue = scale$maxValue))) }