Does anyone know why the legend of the size
aestatic BIR74
won't show the dot sizes but rectangles? If the answer is yes, how can I fix this?
Reproducable example:
library(sf)
# devtools::install_github("tidyverse/ggplot2")
library(ggplot2)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
nc_centers <- st_centroid(nc)
nc_centers %>%
ggplot() +
geom_sf(aes(color = SID79, size = BIR74)) +
coord_sf(datum = NA) +
theme_minimal()
you need to add the show.legend argument to geom_sf, i.e.
nc_centers %>%
ggplot() +
geom_sf(aes(color = SID79, size = BIR74), show.legend = 'point') +
coord_sf(datum = NA) +
theme_minimal()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With