From 2b2b91588aadf388927604fc32eedabea0d5a742 Mon Sep 17 00:00:00 2001 From: Roberto Date: Mon, 27 Mar 2023 00:15:43 +0200 Subject: [PATCH] solved issue Error in grDevices::rgb(red = df, green = df, blue = df, : color intensity NA, not in [0,1] --- R/plot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/plot.R b/R/plot.R index 968cdde..1169541 100644 --- a/R/plot.R +++ b/R/plot.R @@ -66,7 +66,7 @@ gg_raster <- function(r, r_type = "RGB", gglayer = F, ...){ } # remove NAs - na.sel <- is.na(df$val1) & is.na(df$val2) & is.na(df$val3) + na.sel <- is.na(df$val1) | is.na(df$val2) | is.na(df$val3) if(any(na.sel)) df <- df[!na.sel,] df$fill <- grDevices::rgb(red = df$val1, green = df$val2, blue = df$val3, maxColorValue = maxColorValue)