0

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))
PPet
  • 11
  • 1
    Thanks for providing a nice self-contained example. However, your question is a bit unclear. Maybe a sketch or a reformulation would help? If you do not have the privileges to post a figure, post it and someone else can make it public. – Dieter Menne Feb 18 '16 at 08:03
  • 1
    maybe you need something like this? http://stackoverflow.com/questions/7836279/ggplot2-piecharts-instead-of-points-in-an-xy-scatterplot?lq=1 – inscaven Feb 18 '16 at 09:40

0 Answers0