2

I'm trying to modify the legend to a map by removing the borders around particular cells within the legend.

A simplified version of my code looks like this:

ggplot() + 
  stat_density2d(data = carto@data,
                 aes(x=field_2,y=field_1),
                 geom="polygon",
                 alpha = .37,
                 fill = "#e29206") +
  geom_point(data = Schools@data[Schools@data$sch_type == "Charter" | Schools@data$sch_type == "District", ],
             aes(x = x, y = y, color = sch_type, shape = grade_cat),
             size = 1) +
  scale_colour_manual(values=c("#e0100d", "#4753ff")) +
  guides(color=guide_legend(override.aes=list(fill = "white"))) +
  theme(legend.key = element_blank()) +
  coord_map()

which produces the following image:

enter image description here

I would like to remove the blue and red borders on the top two legend cells. If I add color to the override.aes() arguments within guides() it changes the borders, but also makes the charter and district colors the same. Is there a different argument I could use in the place of color?

I looked at these two questions (among various sources) before posting:

Different legend-keys inside same legend in ggplot2

ggplot2 avoid boxes around legend symbols

Community
  • 1
  • 1
ZLevine
  • 312
  • 3
  • 11

0 Answers0