I have made a graph with facet_grid
to visualize the percentage of litium in each group per treatment on each day.
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
resulting with this:
For that I have two problems:
I cant make proper error bars for the litium content PER GROUP. I have tried this, but I only get error bars per treatment.
ms.chl + geom_errorbar(aes(ymin=litium-se, ymax=litium+se), size=0.5,
width=.25,
position=position_dodge(.9)) +
facet_grid(~day)
I would like to have error bars from the total of each group
and after that, my second question is: is it possible to represent the absolute value per group and the percentage only for each treatment?
Data set (mus):
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