Skip to content

Only RHS-formula accepted as lambda function #6385

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

Merged
merged 3 commits into from
May 19, 2025

Conversation

teunbrand
Copy link
Collaborator

Thsi PR aims to fix #6384 and amends #6200.

Briefly, the reason bquote() input for scale names wasn't accepted is because it was interpreted as a two-sided formula.
This PR only attempts to cast a RHS-only formula as a function.

Reprex from issue:

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

eff <- "Efficiency"
ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() + 
  scale_y_continuous(name = bquote(.(eff)~(mi~gl^{-1})))

Created on 2025-03-28 with reprex v2.1.1

@teunbrand teunbrand changed the title Lambda bquote Only RHS-formula accepted as lambda Mar 28, 2025
@teunbrand teunbrand changed the title Only RHS-formula accepted as lambda Only RHS-formula accepted as lambda function Mar 28, 2025
@teunbrand teunbrand added this to the ggplot2 4.0.0 milestone May 6, 2025
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand teunbrand merged commit 2bce668 into tidyverse:main May 19, 2025
13 checks passed
@teunbrand teunbrand deleted the lambda_bquote branch May 19, 2025 12:39
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 this pull request may close these issues.

Some values returned by bquote() trigger errors (3.5.1.9000)
2 participants