Colors lost in legend when using scale_shape_manual

后端 未结 1 1976
迷失自我
迷失自我 2020-12-06 20:02

I am trying to plot points using filled shapes from position 21 of the shapes.

d <- data.frame(expand.grid(a=letters[1:4],
      b=factor(1:2)), y=rnorm(8         


        
相关标签:
1条回答
  • 2020-12-06 20:38

    For some reason, the fill legend defaults to shape symbol 1 (solid circle), so it shows the color rather than the fill aesthetic. Add this to the ggplot command:

      + guides(fill=guide_legend(override.aes=list(shape=21))) 
    

    enter image description here

    0 讨论(0)
提交回复
热议问题