blob: 10f2d36c94423fe0592aace7193fd0d5d7a58c4b [file] [log] [blame]
Marc Kupietz899ba2a2022-03-17 21:50:22 +01001#!/bin/env Rscript
2library(tidyverse)
3library(idsThemeR) # install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")
4library(extrafont)
5
6df <- read_tsv("performance.tsv")
7df %>%
8 fill(Tool) %>%
9 mutate(order_by = pmax(.[[6]], .[[7]], na.rm = TRUE)) %>%
10 filter(Tool!="wc", !is.na(order_by)) %>%
11 pivot_longer(cols=c(7, 6)) %>%
12 mutate(name=str_replace_all(name, ".*[^0-9]([0-9]+)x.*", "\\1 × Effi")) %>%
13 mutate(tool = paste0(Tool, if_else(is.na(Model), "", paste0(" (", Model, ")")))) %>%
14 { df2 <<- . } %>%
15 mutate(Tool= factor(tool) %>% fct_reorder(order_by)) %>%
16 ggplot(aes(x=Tool, y=value, fill=name )) + # forcats::fct_rev(name) to reorder x1 and x10
17 geom_col(position="dodge") +
18 labs(x="Tokens / ms", y= NULL, fill = "test corpus") +
19 coord_flip() +
20 theme_ids(style="light") +
21 theme(legend.position = c(0.8, 0.2)) +
22 scale_fill_ids(palette = "ids")
23
24ggsave("tok_perf.png", width = 70 * .pt, height = 50 *.pt, units = "mm", dpi = 600)
25ggsave("tok_perf.pdf", device = cairo_pdf, width = 70 * .pt, height = 50 *.pt, units = "mm", dpi = 600)
26ggsave("tok_perf.svg", width = 70 * .pt, height = 50 *.pt, units = "mm", dpi = 600)