Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed byrow=FALSE reorder not only plots but also labels #203

Merged
merged 3 commits into from
Jan 12, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
change the tests
Doubt-0KB committed Jan 11, 2025
commit affdb46db15a4e35d96c3330c9f06ba3bf12916c
85 changes: 0 additions & 85 deletions tests/figs/plot-grid/byrow-is-false.svg

This file was deleted.

85 changes: 0 additions & 85 deletions tests/figs/plot-grid/byrow-is-true.svg

This file was deleted.

15 changes: 7 additions & 8 deletions tests/testthat/test_plot_grid.R
Original file line number Diff line number Diff line change
@@ -102,14 +102,13 @@ test_that("alignment", {


test_that("labels reorder by byrow", {

# byrow=TRUE
p_list <- lapply(1:3, \(x) ggplot())
g <- plot_grid(plotlist = p_list, ncol = 2, labels = 1:3, byrow = TRUE)
expect_equal(layer_data(g, 4)$label, 2)

expect_doppelganger("byrow is TRUE",
plot_grid(plotlist = p_list, ncol = 2, labels = 1:3, byrow = TRUE)
)

expect_doppelganger("byrow is FALSE",
plot_grid(plotlist = p_list, ncol = 2, labels = 1:3, byrow = FALSE)
)
# byrow=FALSE
p_list <- lapply(1:3, \(x) ggplot())
g <- plot_grid(plotlist = p_list, ncol = 2, labels = 1:3, byrow = FALSE)
expect_equal(layer_data(g, 4)$label, 3)
})