我正在尝试连接来自 geom_jitter()
的点。
df<-data.frame(x = c(1, 1, 2, 2, 3, 3),
y = c(1, 1, 2 , 3, 6, 5),
z = c("A", "B", "A", "B", "A", "B"))
ggplot(df, aes(x = x, y = y, col = z)) +
geom_jitter() +
geom_line()
现在线和点没有连接。
最佳答案
library(dplyr)
ggplot(df %>% mutate(x = jitter(x), y = jitter(y)),
aes(x = x, y = y, col = z)) +
geom_point() +
geom_line()
关于r - 连接 ggplot2 中的 geom_jitter 点的线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57781581/