Skip to content

Commit

Permalink
Merge pull request #20 from robertomrosati/master
Browse files Browse the repository at this point in the history
Possibly solved issue "Error in grDevices::rgb(red = df, green = df, blue = df, : color intensity NA, not in [0,1]"
  • Loading branch information
16EAGLE authored Mar 3, 2024
2 parents a180b5d + 2b2b915 commit d394884
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d394884

Please sign in to comment.