Skip to content

Commit f2ae548

Browse files
committed
update tests etc
1 parent 7ff5582 commit f2ae548

17 files changed

+78
-261
lines changed

NAMESPACE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ importFrom(ggplot2,ggplotGrob)
112112
importFrom(ggplot2,ggplot_add)
113113
importFrom(ggplot2,ggplot_build)
114114
importFrom(ggplot2,ggplot_gtable)
115-
importFrom(ggplot2,is.ggplot)
116-
importFrom(ggplot2,is.theme)
115+
importFrom(ggplot2,is_ggplot)
116+
importFrom(ggplot2,is_theme)
117+
importFrom(ggplot2,is_waiver)
117118
importFrom(ggplot2,labs)
118119
importFrom(ggplot2,margin)
119120
importFrom(ggplot2,max_height)

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# patchwork (development version)
22

3+
* Fixed a load-time bug that could throw spurious warnings
4+
35
# patchwork 1.3.1
46

57
* Prepare for next ggplot2 release

R/aaa.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,3 @@ check_object <- function(x,
4444
call = call
4545
)
4646
}
47-
48-
is_waiver <- function(x) inherits(x, "waiver")

R/arithmetic.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ NULL
6868
if (is.null(e2)) return(e1)
6969
if (is.null(e1)) return(e2)
7070
if (should_autowrap(e2)) e2 <- wrap_elements(full = e2)
71-
if (!is.ggplot(e2)) cli_abort("Only knows how to fold ggplot objects together")
71+
if (!is_ggplot(e2)) cli_abort("Only knows how to fold ggplot objects together")
7272
patchwork <- new_patchwork()
7373
if (is_patchwork(e2)) {
7474
plot <- plot_filler()
@@ -122,12 +122,12 @@ NULL
122122
e1 + e2
123123
}
124124
#' @rdname plot_arithmetic
125-
#' @importFrom ggplot2 is.theme
125+
#' @importFrom ggplot2 is_theme
126126
#' @export
127127
"&.gg" <- function(e1, e2) {
128128
if (is.null(e2)) return(e1)
129129
if (is_patchwork(e1)) {
130-
if (is.theme(e2)) {
130+
if (is_theme(e2)) {
131131
e1$patches$annotation$theme <- e1$patches$annotation$theme + e2
132132
}
133133
e1$patches$plots <- lapply(e1$patches$plots, function(p) {

R/free.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#' reserve any space for it. This allows the axis to occupy space in an
3131
#' otherwise empty area without making additional space available for itself.
3232
#'
33-
#' @importFrom ggplot2 is.ggplot
33+
#' @importFrom ggplot2 is_ggplot
3434
#' @export
3535
#'
3636
#' @examples
@@ -72,7 +72,7 @@
7272
#' plot_spacer() + free(p1, "space", "l") + p2 + p2
7373
#'
7474
free <- function(x, type = c("panel", "label", "space"), side = "trbl") {
75-
check_object(x, function(x) is.ggplot(x) || is_patchwork(x), "a <ggplot> or <patchwork> object")
75+
check_object(x, function(x) is_ggplot(x) || is_patchwork(x), "a <ggplot> or <patchwork> object")
7676
type <- arg_match(type)
7777
side <- tolower(side)
7878
if (grepl("[^trbl]", side)) {

R/inset_element.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ inset_element <- function(p, left, bottom, right, top, align_to = 'panel', on_to
7070
if (!is.unit(top)) {
7171
top <- unit(top, 'npc')
7272
}
73-
if (!is.ggplot(p)) {
73+
if (!is_ggplot(p)) {
7474
p <- wrap_elements(full = p, clip = FALSE)
7575
}
76-
if (!is.ggplot(p)) {
76+
if (!is_ggplot(p)) {
7777
p <- wrap_elements(full = p, clip = clip)
7878
}
7979
clip <- if (clip) 'on' else 'off'

R/plot_annotation.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ on_load({
102102
})
103103

104104
#' @importFrom utils modifyList
105+
#' @importFrom ggplot2 is_waiver
105106
#' @export
106107
ggplot_add.plot_annotation <- function(object, plot, object_name) {
107108
plot <- as_patchwork(plot)
@@ -115,7 +116,7 @@ ggplot_add.plot_annotation <- function(object, plot, object_name) {
115116
plot$patches$annotation[names(do_change)] <- do_change
116117
plot
117118
}
118-
#' @importFrom ggplot2 is.ggplot labs
119+
#' @importFrom ggplot2 is_ggplot labs
119120
recurse_tags <- function(x, levels, prefix, suffix, sep, offset = 1) {
120121
if (length(levels) == 0) return(list(patches = x, tab_ind = offset))
121122
level <- get_level(levels[1])

R/plot_layout.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#'
4444
#' @export
4545
#'
46+
#' @importFrom ggplot2 is_waiver
4647
#' @examples
4748
#' library(ggplot2)
4849
#'
@@ -314,6 +315,7 @@ default_layout <- plot_layout(
314315
axes = 'keep', axis_titles = 'keep'
315316
)
316317
#' @importFrom utils modifyList
318+
#' @importFrom ggplot2 is_waiver
317319
#' @export
318320
ggplot_add.plot_layout <- function(object, plot, object_name) {
319321
plot <- as_patchwork(plot)

R/plot_multipage.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ ggplot_gtable.fixed_dim_build <- function(data) {
128128
#' @rdname multipage_align
129129
#' @export
130130
get_max_dim <- function(...) {
131-
if (is.ggplot(..1)) {
131+
if (is_ggplot(..1)) {
132132
plots <- list(...)
133133
} else if (is.list(..1)) {
134134
plots <- ..1
@@ -148,7 +148,7 @@ get_max_dim <- function(...) {
148148
#' @rdname multipage_align
149149
#' @export
150150
align_patches <- function(...) {
151-
if (is.ggplot(..1)) {
151+
if (is_ggplot(..1)) {
152152
plots <- list(...)
153153
} else if (is.list(..1)) {
154154
plots <- ..1

R/plot_patchwork.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ names.patchwork <- function(x) NULL
9494
cli_abort('Patchworks can only be indexed with numeric indices')
9595
}
9696

97-
if (!is.ggplot(value)) {
97+
if (!is_ggplot(value)) {
9898
value <- wrap_elements(value)
9999
}
100100
n_patches <- length(x$patches$plots)

0 commit comments

Comments
 (0)