Hi Dagmar, I think you want something like a gantt.chart. I know this is wrong in some ways, but it is late and I must retire:
datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon"), changepoint=as.Date(c("03.01.2011","05.01.2011", "27.01.2011", "26.01.2011","28.01.2011", "28.02.2011"), "%d.%m.%Y"), knownstate =c("breeding",NA, NA,"breeding","moulting",NA)) library(plotrix) tm.info<-list(labels=datframe$Name, starts=c(as.Date("01.01.2011","%d.%m.%Y"),datframe$changepoint[1:2], as.Date("01.01.2011","%d.%m.%Y"),datframe$changepoint[4:5]), ends=datframe$changepoint) gantt.chart(tm.info,xlim=as.Date(c("1.1.2011","1.3.2011"),"%d.%m.%Y"), taskcolors=c(2,3,3,2,"orange",3)) Jim On Tue, Dec 6, 2016 at 9:28 PM, Dagmar <ramga...@gmx.net> wrote: > # Dear all, > # I hope someone can help me with this, I am kind of desperated even though > it doesn't sound tooooo complicated at all. Let's see: > # I have a data frame like this: > datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon"), > changepoint =as.POSIXct > (strptime(as.character("03.01.2011","05.01.2011", "27.01.2011", > "26.01.2011","28.01.2011", "28.02.2011"), "%d.%m.%Y")), > knownstate =c("breeding",NA, > NA,"breeding","moulting",NA)) > datframe > str(datframe) > # Now I want a stacked horizontal bar diagram: One bar-line for animal Kati > and bellow one for animal Leon. > # Each bar should be "drawn" along the time (on the x-axes) and be > interupted (by a vertical line) at the changepoints > # then additionally I want colours for the known states (e.g. red for the > time from 03.01.2011 to 05.01.2011 when animal Kati was breeding) > > # help would be much appreciated! > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.