16EAGLE / basemaps

A lightweight package for accessing basemaps from open sources in R 🗺️
https://jakob.schwalb-willmann.de/basemaps
GNU General Public License v3.0
57 stars 15 forks source link

Possibly solved issue "Error in grDevices::rgb(red = df, green = df, blue = df, : color intensity NA, not in [0,1]" #20

Closed robertomrosati closed 6 months ago

robertomrosati commented 1 year ago

Hi,

I was struggling with the error "Error in grDevices::rgb(red = df, green = df, blue = df, : color intensity NA, not in [0,1]" (reported also in issue #19 by seaCatKim) , i found out that the reason was the line 69 in the plot.R file (in function gg_raster).

Indeed, the line was:

na.sel <- is.na(df$val1) & is.na(df$val2) & is.na(df$val3)

but this was actually used to remove rows only when all val1, val2 and val3 were NA, leaving untouched rows where one or two of them were NA, so I changed it into:

na.sel <- is.na(df$val1) | is.na(df$val2) | is.na(df$val3)

I don't know if it is the most suitable solution, but it seems to be working.

Best, Roberto

ntworthk commented 1 year ago

+1 I have a fork that applied the same fix, working well for me too

16EAGLE commented 6 months ago

Thanks!