Skip to content

Commit

Permalink
Merge titles more aggressively (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Jul 8, 2024
1 parent d943757 commit 3a92584
Show file tree
Hide file tree
Showing 2 changed files with 428 additions and 431 deletions.
15 changes: 7 additions & 8 deletions R/collect_axes.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,15 @@ grob_id <- function(grobs, layout, byrow, merge = FALSE) {
hash <- vapply(grobs[idx], function(x) hash(unname_grob(x)), character(1))

# For multi-cell grobs, compute an extra identifier
index <- if (byrow) col(layout) else row(layout)
min <- ave(index, layout, FUN = min)
max <- ave(index, layout, FUN = max)
identifier <- paste0(min, ";", max)
if (merge) {
identifier[min == max] <- ""
if (!merge) {
index <- if (byrow) col(layout) else row(layout)
min <- ave(index, layout, FUN = min)
max <- ave(index, layout, FUN = max)
identifier <- paste0(min, ";", max)
# Include the multi-cell identifier in the hash
hash <- paste0(hash, identifier[valid])
}

# Include the multi-cell identifier in the hash
hash <- paste0(hash, identifier[valid])
layout[valid] <- match(hash, unique(hash))
layout
}
Expand Down
Loading

0 comments on commit 3a92584

Please sign in to comment.