以下是我的一些数据:
df <- structure(list(yrmonth = structure(c(1483228800, 1483228800,
1483228800, 1485907200, 1485907200, 1485907200, 1488326400, 1488326400,
1488326400, 1491004800, 1491004800, 1491004800), class = c("POSIXct",
"POSIXt"), tzone = "UTC"), index = structure(c(1L, 3L, 5L, 1L,
3L, 5L, 1L, 3L, 5L, 1L, 3L, 5L), .Label = c("N-S", "N-S", "E-W",
"E-W", "OS"), class = "factor"), N = c(2, 2, 1, 2, 2, 1, 2, 2,
1, 2, 2, 1), GDDLettuce = c(129, 141, 27, 150.5, 209, 87, 247.5,
243, 188, 223, 226.5, 170), sd = c(1.4142135623731, 4.24264068711928,
NA, 4.94974746830583, 65.0538238691624, NA, 12.0208152801713,
8.48528137423857, NA, 5.65685424949238, 0.707106781186548, NA
), se = c(1, 3, NA, 3.5, 46, NA, 8.5, 6, NA, 4, 0.5, NA), ci = c(12.7062047361747,
38.1186142085241, NA, 44.4717165766114, 584.485417864036, NA,
108.002740257485, 76.2372284170481, NA, 50.8248189446988, 6.35310236808735,
NA)), .Names = c("yrmonth", "index", "N", "data", "sd",
"se", "ci"), row.names = 31:42, class = "data.frame")
当误差线添加到折线图时,它们并不总是以与线条相同的方式堆叠在图形上。如何更改图表上误差线的顺序?
这是我的图表代码:
ggplot(df, aes(x=yrmonth,y=data,colour=index)) +
geom_errorbar(aes(ymin=data-se, ymax=data+se), width = 700000,
position = position_jitterdodge(jitter.width = 0, jitter.height = 0,
dodge.width = 200000)) +
geom_line()
在这种情况下,当误差线低于线时,E-W位于行进之前。我想调整它,以便所有E-W误差条位于N-S线和误差线之上。