From 70b0bc8e6bfcac42dadf9267f2577cccdfcf1367 Mon Sep 17 00:00:00 2001 From: mtennekes Date: Thu, 2 Jan 2025 09:15:58 +0100 Subject: [PATCH] fixed 996 --- R/tmapScaleDiscrete.R | 5 +++++ R/tmapScaleIntervals.R | 5 +++++ R/tmapScale_misc.R | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/R/tmapScaleDiscrete.R b/R/tmapScaleDiscrete.R index 561c37e00..c90750d58 100644 --- a/R/tmapScaleDiscrete.R +++ b/R/tmapScaleDiscrete.R @@ -89,6 +89,11 @@ tmapScaleDiscrete = function(x1, scale, legend, chart, o, aes, layer, layer_args cfun = paste0("tmapValuesColorize_", aes) if (is.na(value.neutral)) value.neutral = VV$value.neutral else value.neutral = do.call(sfun, list(x = do.call(cfun, list(x = value.neutral, pc = o$pc)), scale = values.scale)) + mfun = paste0("tmapValuesSubmit_", aes) + vvalues = do.call(mfun, list(x = vvalues, args = layer_args)) + value.na = do.call(mfun, list(x = value.na, args = layer_args)) + value.neutral = do.call(mfun, list(x = value.neutral, args = layer_args)) + ids = match(x1, ticks) vals = vvalues[ids] diff --git a/R/tmapScaleIntervals.R b/R/tmapScaleIntervals.R index 482074971..4ef2d98cb 100644 --- a/R/tmapScaleIntervals.R +++ b/R/tmapScaleIntervals.R @@ -119,6 +119,11 @@ tmapScaleIntervals = function(x1, scale, legend, chart, o, aes, layer, layer_arg cfun = paste0("tmapValuesColorize_", aes) if (is.na(value.neutral)) value.neutral = VV$value.neutral else value.neutral = do.call(sfun, list(x = do.call(cfun, list(x = value.neutral, pc = o$pc)), scale = values.scale)) + mfun = paste0("tmapValuesSubmit_", aes) + vvalues = do.call(mfun, list(x = vvalues, args = layer_args)) + value.na = do.call(mfun, list(x = value.na, args = layer_args)) + value.neutral = do.call(mfun, list(x = value.neutral, args = layer_args)) + ids = classInt::findCols(q) vals = vvalues[ids] diff --git a/R/tmapScale_misc.R b/R/tmapScale_misc.R index 70d9113bd..dc0089355 100644 --- a/R/tmapScale_misc.R +++ b/R/tmapScale_misc.R @@ -36,7 +36,7 @@ get_scale_defaults = function(scale, o, aes, layer, cls, ct = NULL) { } else values value.na = if (is.na(value.na) || isTRUE(value.na)) { - m = getPalMeta(as.character(values[1])) + m = if (aes %in% c("col", "fill")) getPalMeta(as.character(values[1])) else NULL ona = getAesOption("value.na", o, aes, layer, cls = cls) # take option value.na instead of cols4all palette na-color in these two cases: