我正在尝试使用geom_point()在ggplot2中获得一个具有映射到x,y,颜色和形状的变量的图,并避开颜色的位置而不是形状。
x=tibble(Color=c(rep('A',12),rep('B',12),rep('C',12)),
Shape=rep(c(rep('A',3),rep('B',3),rep('C',3),rep('D',3)),3),
xVar=rep(c('A','B','C'),12),
Value=rnorm(36))
ggplot(x,aes(xVar,Value,color=Color,shape=Shape))+
geom_point(position=position_dodge(width=.5))
Run Code Online (Sandbox Code Playgroud)
是否可以将闪避位置限制为仅一种美学?我已经搜索过文档和堆栈溢出,但是还没有发现任何东西。
该group决定闪躲,所以可以这样做:
ggplot(x,aes(xVar,Value,color=Color,shape=Shape,group=Shape))+
geom_point(position=position_dodge(width=.5))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
577 次 |
| 最近记录: |