Skip to content

Instantly share code, notes, and snippets.

@mtorchiano
Last active April 28, 2020 11:59
Show Gist options
  • Save mtorchiano/a4fa89e73e079942bf06370bbc3861b7 to your computer and use it in GitHub Desktop.
Save mtorchiano/a4fa89e73e079942bf06370bbc3861b7 to your computer and use it in GitHub Desktop.
PROFES2020 Timeline diagram (post-COVID-19)
library(tidyverse)
library(scales)
schedule <- data.frame(Date = c("2020-07-13", "2020-07-20", "2020-07-27", "2020-07-31",
"2020-09-07", "2020-09-14", "2020-09-14", "2020-09-14", "2020-10-05",
"2020-10-12"),
Event = c("Abstracts", "Submission", "Submission", "Submission",
"Notification", "Notification", "Notification", "Submission",
"Notification", "Camera Ready"),
Track = c("Full", "Full", "Industry", "Short", "Full", "Industry",
"Short", "Journal First", "Journal First", "All")
)
vj_vals = list(0.5,c(0.5,0.5),c(0.5,2,0.5))
hj_vals = list(-0.3,c(1.3,-0.3),c(1.2,0.5,-0.3))
schedule <- schedule %>%
mutate(Event = factor(Event,levels(Event)[c(1,4,3,2)],ordered=TRUE)) %>%
arrange(Track,Date) %>% group_by(Track) %>%
mutate( vj = vj_vals[[length(Track)]],
hj = hj_vals[[length(Track)]] )
ggplot(schedule,aes(x=as.Date(Date),y=Track,shape=Event,group=Track,color=Track))+
geom_line()+geom_point()+
geom_text(aes(label=format(as.Date(Date),"%b-%d"),
vjust=vj,hjust=hj),
size=3,color="gray20")+
scale_color_brewer(type="qual",palette=2,guide="none")+
scale_x_date(breaks="1 month", minor_breaks="1 week", labels=date_format(" %b"),
sec.axis=dup_axis(),expand=expansion(0.1))+
scale_shape(name="Events:",guide=guide_legend(nrow=1)) +
xlab("")+ylab("")+
annotate("rect",xmin=as.Date("2020-11-25"),xmax=as.Date("2020-11-27"),
ymin="All",ymax="Short",fill="dodgerblue",alpha=0.5)+
annotate("text",label="PROFES 2020",size=1.5,color="white",angle=90,
x=as.Date("2020-11-25"),y="Industry",vjust=1,hjust=0.5) +
theme_light()+theme(legend.position="top",
legend.justification="right",
legend.margin=margin(0,0,0,0),
legend.box.margin=margin(0,0,-20,0),
axis.text.x=element_text(hjust=0,vjust=5),
axis.text.x.top=element_text(hjust=0,vjust=-5),
axis.ticks.length = unit(5, "mm"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment