I am plotting spatial point data (sf
) with ggplot2
. Color is mapped to an associated value. The legend for color is unexpectedly using a polygon shape as it would for a two-dimensional geom that might have separate color and fill attributes. Is there a way to specify that the shape for the color legend so that I can make it a filled circle?
library(sf)
library(ggplot2)
set.seed(2)
df <- data.frame(x = runif(10, min = 0, max = 10),
y = runif(10, min = 0, max = 10),
value = sample(c(FALSE, TRUE), 10, replace = TRUE))
sf <- st_as_sf(df, coords = c("x", "y"))
ggplot(sf, aes(color=value)) +
geom_sf()