我制作了一个图表,facet_grid
以可视化每天每次治疗中每组锂的百分比。
library(ggplot2)
library(Rmisc)
library(plyr)
mus2 <- summarySE(mus, measurevar="litium",
groupvars=c("treatment", "group", "day"), na.rm = TRUE)
mus2
mus3 <- mus2
mus3$group <- factor(mus3$group)
ms.chl<- ggplot(mus3, aes(x=group, y=litium, fill=treatment)) +
geom_bar(stat="identity", colour="black") + facet_grid(~day) + theme_bw()
ms.chl
结果是:
为此,我有两个问题:
我无法为每个组的锂含量制作正确的误差线。我已经尝试过了,但每次治疗我只会得到误差线。
ms.chl + geom_errorbar(aes(ymin=litium-se, ymax=litium+se), size=0.5,
width=.25,
position=position_dodge(.9)) +
facet_grid(~day)
我想从每组的总数中得到误差线
在那之后,我的第二个问题是:是否可以代表每组的绝对值和每个治疗的百分比?
数据集(亩):
litium group treatment day
0.009439528 1 Control day1
0.005115057 1 Control day1
0.009742297 1 Control day1
0.016515625 2 Control day1
0.01074537 2 Control day1
0.016300836 2 Control day1
0.009538339 3 Control day1
0.010609746 3 Control day1
0.008928012 3 Control day1
0.009425325 1 Control + bird day1
0.00561831 1 Control + bird day1
0.014622517 1 Control + bird day1
0.017702439 2 Control + bird day1
0.010545045 2 Control + bird day1
0.029109907 2 Control + bird day1
0.013737568 3 Control + bird day1
0.015174405 3 Control + bird day1
0.014583832 3 Control + bird day1
0.009244079 1 Control day2
0.006591033 1 Control day2
0.007592587 1 Control day2
0.013676745 2 Control day2
0.016208676 2 Control day2
0.017593952 2 Control day2
0.014003037 3 Control day2
0.01163581 3 Control day2
0.011643067 3 Control day2
0.009229506 1 Control + bird day2
0.006423714 1 Control + bird day2
0.008653163 1 Control + bird day2
0.012441379 2 Control + bird day2
0.0204346 2 Control + bird day2
0.010017788 2 Control + bird day2
0.009745063 3 Control + bird day2
0.00967963 3 Control + bird day2
0.010291306 3 Control + bird day2
0.009466604 1 Fence day2
0.019611081 2 Fence day2
0.006796444 2 Fence day2
0.018928695 2 Fence day2
0.007787736 3 Fence day2
0.009409897 3 Fence day2