ggplot图例中重叠的形状和字符

sco*_*coa 5 r ggplot2

当我绘制具有相同颜色的点和文本时,a图例中的形状和形状重叠.

我可以告诉ggplot不要a在图例中画出来吗?怎么样?

M <- data.frame(t=letters[1:16],
            xx=runif(16),
            yy=runif(16),
            g=rep(c("A","B","C","D"),4))
str(M)

ggplot(M,aes(x=xx,y=yy,label=t,colour=g)) + 
       geom_point(shape=3) + 
       geom_text(vjust=0,hjust=0) + 
       scale_colour_discrete()
Run Code Online (Sandbox Code Playgroud)

muc*_*cio 3

只需添加show_guide = F您的geom_text:

ggplot(M,aes(x=xx,y=yy,label=t,colour=g)) + 
  geom_point(shape=3) + 
  geom_text(vjust=0,hjust=0, show_guide = F) +
  scale_colour_discrete()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述