Add R scripts to plot performance charts

Change-Id: I20d33a47722f515897c79e9e58c49f6391e48eac
diff --git a/charts/performance_chart.R b/charts/performance_chart.R
new file mode 100755
index 0000000..10f2d36
--- /dev/null
+++ b/charts/performance_chart.R
@@ -0,0 +1,26 @@
+#!/bin/env Rscript
+library(tidyverse)
+library(idsThemeR) # install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")
+library(extrafont)
+
+df <- read_tsv("performance.tsv")
+df %>%
+  fill(Tool) %>%
+  mutate(order_by = pmax(.[[6]], .[[7]], na.rm = TRUE)) %>%
+  filter(Tool!="wc", !is.na(order_by)) %>%
+  pivot_longer(cols=c(7, 6)) %>%
+  mutate(name=str_replace_all(name, ".*[^0-9]([0-9]+)x.*", "\\1 × Effi")) %>%
+  mutate(tool = paste0(Tool, if_else(is.na(Model), "", paste0(" (", Model, ")")))) %>%
+  { df2 <<- . } %>%
+  mutate(Tool= factor(tool) %>% fct_reorder(order_by)) %>%
+  ggplot(aes(x=Tool, y=value, fill=name )) + # forcats::fct_rev(name) to reorder x1 and x10
+  geom_col(position="dodge") +
+  labs(x="Tokens / ms", y= NULL, fill = "test corpus") +
+  coord_flip() +
+  theme_ids(style="light") +
+  theme(legend.position = c(0.8, 0.2)) +
+  scale_fill_ids(palette = "ids")
+
+ggsave("tok_perf.png", width = 70 * .pt, height = 50 *.pt, units = "mm", dpi = 600)
+ggsave("tok_perf.pdf", device = cairo_pdf, width = 70 * .pt, height = 50 *.pt, units = "mm", dpi = 600)
+ggsave("tok_perf.svg", width = 70 * .pt, height = 50 *.pt, units = "mm", dpi = 600)