R: GIS / Census data - scale_fill_continuous - need to drop default legend and keep custom legend (using tidycensus)

33 views Asked by At

all - I've created a map of Census block groups shaded by % Families in Poverty. Then, I've overlaid city boundaries and a map of certain types of events. It all looks great except that the color gradient is backwards and not intuitive. I added a scale_fill_continuous with a more intuitive scaling. I now have two different perfectly inconsistent legends only one of which is right. I've tried a number of solutions here on SOF (including: trying to reverse the guides; and adding guides(fill="none") and theme(legend.position = "none")) - but the minute I add a the custom legend, the default legend comes back or I get no legends at all - depending where the guides(fill="none") or theme(legend.position = "none"). Because it's GIS data, even a small dput is large. The code is below. I'm close to dropping the plots as is into PowerPoint and covering up the unwanted legend with a white box. Thanks in advance for any suggestions!

  p <- ggplot(cc_fam, aes(fill = per, color = per)) +
  geom_sf() +
  geom_sf(data = urb_boundaries, fill = NA, color = "red") +
  geom_sf(data = my_sf, colour = "orange", inherit.aes = FALSE) +
  facet_wrap(~variable)
  p + scale_fill_continuous(high = "#132B43", low = "#56B1F7", name = "Percent Families in Poverty")
0

There are 0 answers