Skip to content

Commit

Permalink
fix error when add ggplot element to ggalign_plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Dec 15, 2024
1 parent 5c9db90 commit c44e451
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/plot-.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ methods::setMethod("+", c("ggalign_plot", "ANY"), function(e1, e2) {
# can be displayed in error messages
e2name <- deparse(substitute(e2))
switch(.Generic, # nolint
`+` = plot_add(e1, e2, e2name),
`+` = plot_add(e2, e1, e2name),
stop_incompatible_op(.Generic, e1, e2)
)
})
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-plot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test_that("add ggplot elements works well", {
expect_no_error(ggalign() + geom_point())
expect_no_error(ggfree() + geom_point())
expect_no_error(ggcross() + geom_point())
})

0 comments on commit c44e451

Please sign in to comment.