I have following problem, in my data set I have for identical dates results from different devices. I want to do a plot wit dat on x axis, result on y axis (which is either 0 or 1) ann the colour coded by the number of device. I found the solution with plotting the points with position_dodge. I would like to have per point consisiting of different results a "segmented" point constituted of the different colour codes by device number.
Can anyone help me with that issue?
A short example:
library(ggplot2)
test <-data.frame(device=c(1,1,2,2,3,3), date=c("2011-02-15", "2012-02-15", "2011-02-15", "2012-03-12", "2011-02-15", "2012-03-12"), result=c(1,0,1,0,0,1))
test$device<-as.factor(test$device)
theme_set(theme_bw(16))
p <-ggplot(aes(x = date, y = result, colour=device), data = test) +
geom_point(position=position_dodge(width = 0.1),size=5) +
xlab("date") +
ylab("result") +
scale_y_continuous(breaks=c(0,1))
p + theme(axis.text.x = element_text(angle = 90,vjust = 0.5, hjust = 0))