在ggplot图例中重叠的形状和字符 [英] overlapping shape and character in ggplot legend
本文介绍了在ggplot图例中重叠的形状和字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我用相同的颜色绘制点和文本时, a
和图例中的形状重叠。
When I plot points and text with the same colour, the a
and the shape overlap in the legend.
我可以告诉ggplot不要在图例中绘制 a
?如何?
Can I tell ggplot not to draw the a
in the legend? How?
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()
推荐答案
code> show_guide = F 为您的 geom_text
:
Just add show_guide = F
for your 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()
这篇关于在ggplot图例中重叠的形状和字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文