Join GitHub today
scale_fill* doesn't see NaN as NA #1482
Had some weirdness in my plots and eventually tracked it down. the
# four points, top ones are NA and NaN df <- data.frame( x = c(1, 2, 1, 2), y = c(1, 1, 2, 2), z = c(1, 2, NA, NaN) ) # ggplot sees top left as NA and colors red, # but the NaN on top right colors white (which # is invisible if the background is white) ggplot(df, aes(x, y)) + geom_point(aes(colour = z), size = 50) + scale_colour_gradient(na.value = "red")
I don't think this is the desired behavior.
It's also difficult to debug why this is happening because many R functions will put
all.equal( a <- mean(c(NA, 10), na.rm = FALSE), b <- mean(c(NA, NA), na.rm = TRUE) )
Also, while the View() function in Rgui will show