Skip to content

Commit

Permalink
Fix #214 Get fixed state after insets have been merged
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Dec 15, 2020
1 parent 67c8934 commit cb91bba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

* Use vdiffr conditionally to pass test on M1 mac
* Add `str()` method to patchwork objects
* Fix a bug in `inset_element()` when insetting plots with fixed dimensions
(#214)

# patchwork 1.1.0

* Add `inset_element()` to allow adding plots as insets
Expand Down
4 changes: 2 additions & 2 deletions R/plot_patchwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ build_patchwork <- function(x, guides = 'auto') {
x$layout$guides
}
gt <- lapply(x$plots, plot_table, guides = guides)
fixed_asp <- vapply(gt, function(x) isTRUE(x$respect), logical(1))
guide_grobs <- unlist(lapply(gt, `[[`, 'collected_guides'), recursive = FALSE)
gt <- lapply(gt, simplify_gt)
gt <- add_insets(gt)
fixed_asp <- vapply(gt, function(x) isTRUE(x$respect), logical(1))
if (is.null(x$layout$design)) {
if (is.null(x$layout$ncol) && !is.null(x$layout$widths) && length(x$layout$widths) > 1) {
x$layout$ncol <- length(x$layout$widths)
Expand All @@ -140,7 +140,7 @@ build_patchwork <- function(x, guides = 'auto') {
x$layout$nrow <- length(x$layout$heights)
}
dims <- wrap_dims(length(gt), nrow = x$layout$nrow, ncol = x$layout$ncol)
x$layout$design <- create_design(dims[2], dims[1], x$layout$byrow)
x$layout$design <- create_design(dims[2], dims[1], isTRUE(x$layout$byrow))
} else {
dims <- c(
max(x$layout$design$b),
Expand Down

0 comments on commit cb91bba

Please sign in to comment.