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

Using free() with plot_annotation() raises an error (sometimes) #405

Open
trekonom opened this issue Oct 30, 2024 · 0 comments
Open

Using free() with plot_annotation() raises an error (sometimes) #405

trekonom opened this issue Oct 30, 2024 · 0 comments

Comments

@trekonom
Copy link

trekonom commented Oct 30, 2024

When running an older code of mine I stumbled over a possible bug introduced in version 1.3.0 when using free() and plot_annotation()

Without plot_annotation() the following reprex works fine:

library(ggplot2)
library(patchwork)

packageVersion("patchwork")
#> [1] '1.3.0'

list(free(ggplot()), ggplot()) |>
  wrap_plots()

But adding plot_annotation() raises an error:

list(free(ggplot()), ggplot()) |>
  wrap_plots() &
  plot_annotation()
#> Error in split.default(names(settings), settings): first argument must be a vector

Moreover, the issue does not arise in general but depends on the position of the plot to which free() is applied, e.g. if I switch the plots which make up the patch we don't get an error.

list(ggplot(), free(ggplot())) |>
  wrap_plots() &
  plot_annotation()

And as a reference, the buggy code worked fine in version 1.2.0:

library(ggplot2)
library(patchwork)

packageVersion("patchwork")
#> [1] '1.2.0'

list(free(ggplot()), ggplot()) |>
  wrap_plots() &
  plot_annotation()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant