I have a simple data set with two groups and a value for each group at 4 different time points. I want to display this data set as grouped boxplots over time but ggplot2 doesn't separate the time points.
This is my data:
matrix
Replicate Line Day Treatment X A WT Marker Proportion
1 C 10 low NA HuCHuD_Pos 8.62
2 C 10 low NA HuCHuD_Pos NA
1 C 18 low NA HuCHuD_Pos 30.50
3 C 18 low NA HuCHuD_Pos NA
2 C 18 low NA HuCHuD_Pos NA
1 C 50 low NA HuCHuD_Pos 26.10
2 C 50 low NA HuCHuD_Pos 31.90
1 C 80 low NA HuCHuD_Pos 12.70
2 C 80 low NA HuCHuD_Pos 26.20
1 C 10 normal NA HuCHuD_Pos NA
2 C 10 normal NA HuCHuD_Pos 17.20
1 C 18 normal NA HuCHuD_Pos 3.96
2 C 18 normal NA HuCHuD_Pos NA
1 C 50 normal NA HuCHuD_Pos 25.60
2 C 50 normal NA HuCHuD_Pos 17.50
1 C 80 normal NA HuCHuD_Pos 19.00
NA C 80 normal NA HuCHuD_Pos NA
And this is my code:
matrix = as.data.frame(subset(data.long, Line == line_single & Marker == marker_single & Day != "30"))
pdf(paste(line_name_single, marker_name_single, ".pdf"), width=10, height=10)
plot <-
ggplot(data=matrix,aes(x=Day, y=Proportion, group=Treatment, fill=Treatment)) +
geom_boxplot(position=position_dodge(1))
print(plot)
dev.off()
What do I do wrong?
What I want
What I get
Thanks very much for your help!
Cheers, Paula