我的目标是建立一个条形图,在y轴上显示污染物的名称,在x轴上显示浓度。对于每种污染物,将有3个条形图表示各个阶段(1、2和3)的平均浓度。应该添加误差线,以显示每个阶段每种污染物的最大测量浓度。
dput((head(data,100)))
structure(list(phase = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), X = c(2.2, 2.6,
3.5, 2.7, 3.1, 3.2, 1.7, 1.8, 2.5, 1.4, 3.4, 4.1, 3.8, 3.2, 0.8,
0.8, 0, 0, 0, 1.3, 0, 1.7, 2.1, 1.2, 1.7, 2.5, 1.8, 1.7, 1.2,
1.3, 1.4, 0.9, 1.4, 0, 0, 0.6, 0, 0, 0, 3.8, 0, 0, 0, 0, 0, 0,
1, 0.7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0.9, 0.8, 0, 0, 0, 0,
0, 0, 0, 1.2, 0.5, 0, 0, 0, 0, 0, 0.9, 0.8, 0, 0, 0.6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0, 0.9, 0, 0, 0, 0, 0, 0, 0), CH4 = c(NA,
NA, NA, NA, NA, NA, NA, NA, 1.99, 2.06, 2.08, 2.13, 2.2, 2.48,
2.61, 2.49, 2.44, NA, NA, NA, NA, NA, NA, NA, 1.99, 2.06, 2.08,
2.13, 2.2, 2.48, 2.61, 2.49, 2.44, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, 1.99, 2.06, 2.08, 2.13, 2.2, 2.48, 2.61, 2.49, 2.44, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1.99,
2.06, 2.08)), .Names = c("phase", "X", "CH4"), row.names = c(NA,
100L), class = "data.frame")
#define summarySE function
summarySE <- function(data=NULL, measurevar, groupvars=NULL, na.rm=FALSE,
conf.interval=.95, .drop=TRUE)
我尝试使用ggplot
,但最后我只使用一种污染物的单杠。遗漏了什么?