我正使用summarySE()
包中Rmisc
函数的输出在我的数据上绘制错误条。我想更改每个错误栏上水平线的宽度。出于某种原因,width
无法正常工作。
我已经看过解决方案,但没有一个解决方案:
Width of error bars in ggplot2
ggplot2 position_dodge affects error bar width
没有任何效果。以下是我的数据:
df <- structure(list(yrmonth = structure(c(1456790400, 1456790400,
1456790400, 1459468800, 1459468800, 1459468800, 1462060800, 1462060800,
1462060800, 1464739200, 1464739200, 1464739200), class = c("POSIXct",
"POSIXt"), tzone = "UTC"), index = structure(c(1L, 4L, 5L, 1L,
4L, 5L, 1L, 4L, 5L, 1L, 4L, 5L), .Label = c("N-S", "N-S", "E-W",
"E-W", "OS"), class = "factor"), N = c(2, 1, 1, 2, 1, 1, 2, 1,
1, 2, 1, 1), GDDTomatoes = c(151, 136, 61, 221.5, 211, 151, 273,
253, 207, 376, 386, 362), sd = c(7.07106781186548, NA, NA, 3.53553390593274,
NA, NA, 0, NA, NA, 5.65685424949238, NA, NA), se = c(5, NA, NA,
2.5, NA, NA, 0, NA, NA, 4, NA, NA), ci = c(63.5310236808735,
NA, NA, 31.7655118404367, NA, NA, 0, NA, NA, 50.8248189446988,
NA, NA)), .Names = c("yrmonth", "index", "N", "value",
"sd", "se", "ci"), row.names = c(NA, 12L), class = "data.frame")
这是我的一个ggplot尝试无效。当我使用width
参数时,无论我放入width
的数字,水平线都会完全消失。我想稍微缩短它们。
ggplot(df, aes(x=yrmonth,y=value,colour=factor(index))) +
geom_errorbar(aes(ymin=value-se, ymax=value+se), width=0.5) +
geom_line()