在ggplot2中设置颜色栏的标题为白色



如果我有一个scale_fill_coninuous(name='Servings'),我希望它是白色的。我如何为此设置主题参数?在上面的代码中添加color='white'不起作用。这是我的地图。

 ggplot() + 
  geom_map(data = map.world,map = map.world,colour='white',size=.25, aes(
    map_id = region,
    x=long,
    y=lat,
    fill=beer_servings
  )) + 
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        axis.title.x=element_blank(),
        axis.text.x=element_blank(),
        axis.ticks.x=element_blank(),
        axis.title.y=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        plot.background = element_rect(fill = "black"),
        panel.background = element_rect(fill = "black"),
        legend.background = element_rect(fill='black', 
                                         size=0.5, linetype="solid"),
        legend.text = element_text(colour = 'white'),
        legend.position = 'bottom'
        )+
  scale_fill_continuous(name = "Servings Of Beer nPer Person, 2010")+
  #guides(fill = guide_legend(
    #title.theme = element_text(size=10, colour = "white",angle = 0)))+
  coord_quickmap()

对不起,发现了这个

theme(legend.title =
    element_text(face = "italic", size = 12, angle = 45, color = "grey70") )

最新更新