Skip to content

Commit

Permalink
Fix #317 and fix #293
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Aug 14, 2023
1 parent 1f87c00 commit 0da0f22
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ S3method(has_tag,plot_filler)
S3method(has_tag,spacer)
S3method(has_tag,wrapped_patch)
S3method(length,patch_area)
S3method(length,patchwork)
S3method(names,patchwork)
S3method(patchGrob,guide_area)
S3method(patchGrob,patch)
S3method(patchGrob,table_patch)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
in different order (#274)
* Fixed a bug that prevented nested patchworks with empty columns or rows at the
bottom or to the right to be inserted into a layout (#273)
* Patchwork objects now behaves more correctly like an unnamed list of ggplots.
This makes `View()` work on them (#317), and allow one to use `length()` to
determine the number of patches in a patchwork (#293)

# patchwork 1.1.2

Expand Down
6 changes: 6 additions & 0 deletions R/plot_patchwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ print.patchwork <- function(x, newpage = is.null(vp), vp = NULL, ...) {
#' @export
plot.patchwork <- print.patchwork
#' @export
length.patchwork <- function(x) {
length(x$patches$plots) + !is_empty(x)
}
#' @export
names.patchwork <- function(x) NULL
#' @export
`[[.patchwork` <- function(x, ..., exact = TRUE) {
ind <- ..1
if (!is.numeric(ind)) {
Expand Down

0 comments on commit 0da0f22

Please sign in to comment.