# code adapdated from Bernardo Lares
order <- c("Role", "Place", "Type", "Start", "End")
today <- as.character(Sys.Date())
cv <- data.frame(rbind(
  c("PhD Student in Statistics", "UCLouvain", "Academic", "2017-09-01", today),
  c("MSc in Econometrics", "Maastricht University", "Academic", "2015-09-01", "2016-08-31"),
  c("MSc in Economics", "KULeuven", "Academic", "2013-09-01", "2015-01-01"),
  c("Faculty Exchange", "UIUC, USA", "Academic", "2014-08-01", "2014-12-31"),
  c("BSc in Economics", "UCLouvain", "Academic", "2010-09-01", "2013-08-31"),
  c("Teaching Assistant in Statistics", "UCLouvain", "Work Experience", "2017-09-01", today),
  c("Data Scientist Consultant", "Business & Decision", "Work Experience", "2016-09-01", "2017-07-31"),
  c("European Public Affairs Intern", "BNP Paribas", "Work Experience", "2015-04-01", "2015-07-31"),
  c("Audit Intern", "Deloitte Luxembourg", "Work Experience", "2015-01-01", "2015-03-31"),
  c("International Tennis Chair Umpire", "International Tennis Federation", "Extra", "2015-05-01", today),
  c("Private Tutor in Statistics and R", NA, "Extra", "2019-01-01", today)
))
colnames(cv) <- order
colour <- c("red", "blue", "green")

plot_timeline2 <- function(event, start, end = start + 1, label = NA, group = NA,
                           title = "Curriculum Vitae Timeline", subtitle = "Bernardo Lares",
                           size = 7, colour = "orange", save = FALSE, subdir = NA) {
  df <- data.frame(
    Role = as.character(event), Place = as.character(label),
    Start = lubridate::date(start), End = lubridate::date(end),
    Type = group
  )
  cvlong <- data.frame(pos = rep(
    as.numeric(rownames(df)),
    2
  ), name = rep(as.character(df$Role), 2), type = rep(factor(df$Type,
    ordered = TRUE
  ), 2), where = rep(
    as.character(df$Place),
    2
  ), value = c(df$Start, df$End), label_pos = rep(df$Start +
    floor((df$End - df$Start) / 2), 2))
  maxdate <- max(df$End)
  p <- ggplot(cvlong, aes(
    x = value, y = reorder(name, -pos),
    label = where, group = pos
  )) + geom_vline(
    xintercept = maxdate,
    alpha = 0.8, linetype = "dotted"
  ) + labs(
    title = title,
    subtitle = subtitle, x = NULL, y = NULL, colour = NULL
  ) +
    theme_lares2() + theme(panel.background = element_rect(
      fill = "white",
      colour = NA
    ), axis.ticks = element_blank(), panel.grid.major.x = element_line(
      size = 0.25,
      colour = "grey80"
    ))
  if (!is.na(cvlong$type)[1] | length(unique(cvlong$type)) >
    1) {
    p <- p + geom_line(aes(color = type), size = size) +
      facet_grid(type ~ ., scales = "free", space = "free") +
      guides(colour = FALSE) +
      scale_colour_hue()
  }
  else {
    p <- p + geom_line(size = size, colour = colour)
  }
  p <- p + geom_label(aes(x = label_pos),
    colour = "black",
    size = 2, alpha = 0.7
  )
  if (save) {
    file_name <- "cv_timeline.png"
    if (!is.na(subdir)) {
      dir.create(file.path(getwd(), subdir), recursive = T)
      file_name <- paste(subdir, file_name, sep = "/")
    }
    p <- p + ggsave(file_name, width = 8, height = 6)
    message(paste("Saved plot as", file_name))
  }
  return(p)
}

plot_timeline2(
  event = cv$Role,
  start = cv$Start,
  end = cv$End,
  label = cv$Place,
  group = cv$Type,
  save = FALSE,
  subtitle = "Antoine Soetewey"
)

See my detailed CV at www.antoinesoetewey.com/cv/ or go back to my homepage.