Skip to content

Commit

Permalink
feat(benchmark): Add newline labeller to facet labels
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusSkytte committed Oct 22, 2024
1 parent 4aad419 commit 9040212
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,12 @@ jobs:
# Determine subgroups
groups <- setdiff(colnames(benchmarks), c("expr", "time", "benchmark_function", "database", "version", "n"))
# Allow subgroups
# Apply "dodging" to sub-groups to show graphically
dodge <- ggplot2::position_dodge(width = 0.6)
# Insert newline into database name to improve rendering of figures
labeller <- ggplot2::as_labeller(\(l) stringr::str_replace_all(l, stringr::fixed(" v"), "\nv"))
g <- ggplot2::ggplot(
benchmarks,
ggplot2::aes(
Expand All @@ -205,7 +208,12 @@ jobs:
color = !!switch(length(groups) > 0, as.symbol(groups)))
) +
ggplot2::stat_summary(fun.data = mean_sd, geom = "pointrange", size = 0.5, linewidth = 1, position = dodge) +
ggplot2::facet_grid(rows = ggplot2::vars(benchmark_function), cols = ggplot2::vars(database)) +
ggplot2::facet_grid(
rows = ggplot2::vars(benchmark_function),
cols = ggplot2::vars(database),
scales = "free_y",
labeller = labeller
) +
ggplot2::labs(x = "Codebase version", y = "Time (s)")
if (length(slow_backends) > 1) {
Expand Down

0 comments on commit 9040212

Please sign in to comment.