Skip to content

Commit

Permalink
Fix #370
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Jul 28, 2024
1 parent 5493a47 commit d33fd15
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Imports:
graphics,
rlang (>= 1.0.0),
cli
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
URL: https://patchwork.data-imaginist.com, https://github.com/thomasp85/patchwork
BugReports: https://github.com/thomasp85/patchwork/issues
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# patchwork (development version)

* `free()` now better aligns plots in horizontal direction
* Plot backgrounds are now always placed beneath all other elements in the
patchwork (#370)

# patchwork 1.2.0

Expand Down
4 changes: 2 additions & 2 deletions R/plot_patchwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ build_patchwork <- function(x, guides = 'auto') {
gt_new$layout <- exec(rbind, !!!lapply(seq_along(gt), function(i) {
loc <- design[i, ]
lay <- gt[[i]]$layout
lay$name <- paste0(lay$name, '-', i)
lay$z <- lay$z + ifelse(lay$name == "background", 0, max_z[i])
lay$t <- lay$t + ifelse(lay$t <= PANEL_ROW, (loc$t - 1) * TABLE_ROWS, (loc$b - 1) * TABLE_ROWS)
lay$l <- lay$l + ifelse(lay$l <= PANEL_COL, (loc$l - 1) * TABLE_COLS, (loc$r - 1) * TABLE_COLS)
lay$b <- lay$b + ifelse(lay$b < PANEL_ROW, (loc$t - 1) * TABLE_ROWS, (loc$b - 1) * TABLE_ROWS)
lay$r <- lay$r + ifelse(lay$r < PANEL_COL, (loc$l - 1) * TABLE_COLS, (loc$r - 1) * TABLE_COLS)
lay$z <- lay$z + max_z[i]
lay$name <- paste0(lay$name, '-', i)
lay
}))
table_dimensions <- table_dims(
Expand Down

0 comments on commit d33fd15

Please sign in to comment.