Fill and border colour in geom_point (scale_colour_manual) in ggplot

前端 未结 1 1696
遇见更好的自我
遇见更好的自我 2020-11-28 09:11

I\'m doing an scatter plot using ggplot. I would like to have points with a particular colour and fill (in plot, colour=\"blue\", fill=\"cyan4\", f

相关标签:
1条回答
  • 2020-11-28 09:47

    You'll have to use shapes from 21 to 25. These are the ones that have colour and fill properties:

    ggplot(df, aes(own, method)) + 
         geom_point(colour="white", shape=21, size = 4, 
         aes(fill = factor(label))) + 
         scale_fill_manual(values=c("blue", "cyan4"))
    

    If you want different colours for colour as well, then:

    ggplot(df, aes(own, method)) + 
          geom_point(aes(colour=factor(label), 
          fill = factor(label)), shape=21, size = 4) + 
          scale_fill_manual(values=c("blue", "cyan4")) + 
          scale_colour_manual(values=c("white", "black"))
    
    0 讨论(0)
提交回复
热议问题