library(dplyr) library(readr) library(tidyr) library(forcats) library(ggplot2) theme_set(theme_bw()) timings <- read_csv("n1_timings.csv") %>% mutate(paper = fct_rev(factor(paper, levels=paper))) timings_long_period1 <- timings %>% pivot_longer(c(start, end), names_to="type", values_to="x") timings_long_period2 <- timings %>% pivot_longer(c(period2_start, period2_end), names_to="type", values_to="x") timing_pl <- timings_long_period1 %>% ggplot() + geom_rect( aes(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax), fill="steelblue3", alpha=0.3, data=tibble(xmin=120, xmax=200, ymin=-Inf, ymax=Inf) ) + geom_line(aes(x = x, y = paper), linewidth=4) + geom_line(aes(x = x, y = paper), linewidth=4, data=timings_long_period2, colour="grey60") + labs( x = "Latency (ms)", y = NULL ) + scale_x_continuous(breaks = seq(120, 270, 20)) ggsave("n1_timing.png", timing_pl, width=6.5, height=3.25, device="png", type="cairo", dpi=600) ggsave("n1_timing.pdf", timing_pl, width=6.5, height=3.25, device="pdf")