0
我試圖用geom_point()變量映射到x,y,顏色和形狀以及躲避顏色但沒有形狀的位置來獲取ggplot2中的圖。ggplot2:geom_point()閃避形狀,但不是顏色
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))
是否有可能將閃避位置限制爲僅僅一種審美?我搜索了文檔和堆棧溢出,但還沒有發現任何東西。
如何'ggplot(數據= X)+ geom_point(AES(XVAR,價值,顏色=顏色),位置= position_dodge(width = .5))+ geom_point(aes(xVar,Value,shape = Shape))' – juan
我沒有看到任何其他選項,而是按照juan的建議複製點。你怎麼能在一個位置上有一個點的形狀,而在另一個位置上的顏色呢? –
@PaulEndymion,不需要重複。 – Axeman