我想做出点范围曲线其中基团点不彼此堆叠。 情节应该是这样的: :
做闪避我的最好的尝试是在躲闪参数使用向量:
library(ggplot2)
dat <- structure(list(Treatment = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L), .Label = c("A", "B"), class = "factor"),
Temp = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L,
2L, 2L), .Label = c("10", "20"), class = "factor"), Rep = c(1L,
2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), Meas = c(3L,
2L, 2L, 2L, 6L, 4L, 4L, 3L, 5L, 1L, 2L, 3L), SD = c(2L, 3L,
2L, 2L, 2L, 3L, 2L, 3L, 3L, 3L, 2L, 1L)), .Names = c("Treatment",
"Temp", "Rep", "Meas", "SD"), row.names = c(NA, -12L), class = "data.frame")
ggplot(dat, aes(x = Treatment, y = Meas, ymin = Meas - SD/2, ymax = Meas + SD/2)) +
geom_linerange(aes(color = Temp), position=position_dodge(width=c(0.6,0.4)), size = 1, alpha = 0.5) +
geom_point(aes(color = Temp, shape = Temp), position=position_dodge(width=c(0.6,0.4)), size = 3) +
theme_bw()
这会导致如下图所示的曲线图。 然而,所有的点都没有躲开,我要动点和误差线在Illustrator中获得上述情节表演。 有没有办法使用闪避的说法在某种程度上ggplot2
在两个层面上?