So apparently the thing I wanted to do is even possible with just ggplot2, so I am wondering why someone is even bothering creating a new package for it.
I spent a few more hours trying to find the right options and stuff but here goes:
require(data.table)
require(ggplot2)
require(grid)
setsTimeline <- data.table(Set=c("x","y","z","x","y","z","x","y","z","x","y","z","x"),
StartDate=c(1380708900,1402963200,1420070400,1421280000,1410912000,1396310400,1397520000,1418860800,1404172800,1405382400,1395100800,1412121600,1413331200),
EndDate= c(1395099900,1404171900,1421279100,1430985600,1412120700,1397519100,1402962300,1420069500,1405381500,1410911100,1396309500,1413330300,1418859900))
setsTimeline[,StartLabel:=as.POSIXct(StartDate,tz="UTC",origin="1970-01-01")]
breaks <- c(1380708900,1395100800,1402963200,1410912000,1418860800,1430985600)
labels <- as.POSIXct(breaks,tz="UTC",origin="1970-01-01")
ggplot(setsTimeline, aes(colour=Set)) +
geom_segment(aes(x=StartDate, xend=EndDate, y="group", yend="group"), size=10) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
aspect.ratio=5e-02,
axis.text.x = element_text(colour='black', angle = 45, size = 16, hjust = 1, vjust = 1),
legend.text = element_text(colour='black', size = 16),
legend.title = element_text(colour='black', size = 0),
legend.position = 'top',
plot.title = element_text(colour='black', size = 18),
panel.margin = unit(1, "cm")) +
xlab(NULL) +
ylab(NULL) +
ggtitle("Data timeline with marked sets") +
coord_cartesian(xlim = c(1380708900,1430985600), ylim = NULL) +
scale_x_continuous(breaks=breaks,labels=labels)
results in:
if someone comes by who knows how to get rid of the y-axis and how to get the first x-axis label to remain within the plot area without having to move/turn it, please help me out. I tried plot.margin and panel.margin, but one did nothing and the other kept erroring out.
it is now way past my bedtime and I have a presentation to give tomorrow...