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

Stability of layer names #6295

Open
teunbrand opened this issue Jan 22, 2025 · 0 comments · May be fixed by #6298
Open

Stability of layer names #6295

teunbrand opened this issue Jan 22, 2025 · 0 comments · May be fixed by #6298

Comments

@teunbrand
Copy link
Collaborator

This problem was identified in #6287 and affects 7 packages.

In #5967 we gave layers names. However, some packages insist in manually managing the plot$layers field, which can cause names to disappear. We don't have a good fallback for this situation, but we should. Generally this tends to become a problem after adding >1 layer.

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point()

# To wipe out names
p$layers <- list(geom_path())
p + geom_point() + geom_point()
#> Error:
#> ! Names repair functions can't return `NA` values.

Created on 2025-01-22 with reprex v2.1.1

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

Successfully merging a pull request may close this issue.

1 participant