Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 R ggplot2 中,当我绘制所有零并使用 geom_jitter() 时,一些变化会自动添加到零。我该如何撤消呢?我仍然想要 0 y 轴上的所有点。
y = rep(0,100) x = rep(c("A","B","C","D"),25) D = data.frame(x,y) library(ggplot2) ggplot(D,aes(x=x,y=y))+geom_boxplot() + geom_jitter()
如果您需要保持点并水平分布它们,您可以使用geom_jitter(height = 0). 这将强制垂直变化/抖动为零,但仍允许点水平“抖动”。
geom_jitter(height = 0)
ggplot(D, aes(x = x, y = y)) + geom_boxplot() + geom_jitter(height = 0)