R 如何删除由比例\颜色\手册导致的图例内部的灰色方块?

R 如何删除由比例\颜色\手册导致的图例内部的灰色方块?,r,ggplot2,visualization,R,Ggplot2,Visualization,这是我的密码: ggplot() + geom_sf(st_as_sf(seventeen), mapping = aes(fill = NEIGHBOR_T)) + geom_sf(st_as_sf(new_sp), mapping = aes(color = SafeRating), size = 3.8) + geom_sf(st_as_sf(new_sp), mapping = aes(color = SafeRating), size = 3.8, colo

这是我的密码:

ggplot() + geom_sf(st_as_sf(seventeen), mapping = aes(fill = NEIGHBOR_T)) +
  geom_sf(st_as_sf(new_sp), mapping = aes(color = SafeRating), size = 3.8) +
  geom_sf(st_as_sf(new_sp), mapping = aes(color = SafeRating), size = 3.8,
          colour = "black", pch = 21) + coord_sf(datum = NA) + theme_void() +
  ggtitle("I feel safe in my neighborhood.") +
  theme(plot.title = element_text(hjust = 0.5, size = 35),
        text = element_text(family = "Optima", size = 25),
        legend.position = "bottom",
        legend.key = element_rect(fill = "black"),
        legend.key.size = unit(1, "cm"),
        legend.title.align = 0.5,
        legend.box = "vertical",
        plot.background = element_rect(fill = "white")) +
  scale_fill_manual(name = "Neighborhood Type: ",
                    values = c("#08B6CE", "#398AD7", "#2F66A9")) +
  scale_color_manual(name = "Rating: ",
                     values = c("red", "dark red", "#675E24", "dark green", "green"),
                     labels = c("Strongly Disagree", "Disagree",
                                "Neutral", "Agree", "Strongly Agree"))
以下是可视化当前的外观:


我希望与评分相关的方块可以像邻里类型一样填充。这是如何做到的?

您是否尝试过在
geom\u sf
s中设置
fill
?这是一个与
geom\u sf
的示例。设置
show.legend=“point”
内部
geom_sf
有一些SO帖子涉及到这一点,例如,为了澄清,我不想添加点。我希望评级的方块完全用颜色填充,就像邻里类型一样。你试过在你的
geom\u sf
s中设置
fill
吗?这是一个带有
geom\u sf
的例子。设置
show.legend=“point”
内部
geom_sf
有一些SO帖子涉及到这一点,例如,为了澄清,我不想添加点。我希望收视率的方块完全用颜色填充,就像邻里类型一样。