#!/usr/bin/env Rscript source("common.R") parser <- fig_parser(description = "First-flow packet timeseries") parser$add_argument("--xmin", type = "double", default = 100.0) parser$add_argument("--xmax", type = "double", default = 105.0) args <- parser$parse_args() bins <- read_csv(file.path(args$data, "firstflow_bins.csv"), show_col_types = FALSE) %>% group_by(solution) %>% mutate(t_ms = t_ms - min(t_ms)) %>% ungroup() %>% filter(t_ms >= args$xmin, t_ms <= args$xmax) %>% prepare_solution() p <- ggplot(bins, aes(x = t_ms, y = packets, colour = solution, linetype = solution)) + geom_line(linewidth = 0.9, key_glyph = "rect") + scale_colour_manual(values = LABEL_COLORS, breaks = names(LABEL_COLORS)) + scale_linetype_manual(values = LABEL_LINETYPES, breaks = names(LABEL_LINETYPES)) + scale_x_continuous(breaks = seq(args$xmin, args$xmax, 1)) + scale_y_continuous(breaks = seq(0, 45, 5), limits = c(0, 45)) + labs(x = "Time elapsed (ms)", y = paste0("Packets per 50 ", label_us(), " bin")) + theme_paper() + theme(legend.text = element_text(size = rel(0.8)), legend.key.size = unit(6, "pt")) save_figure(p, args)