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

New label_glue() function #459

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

teunbrand
Copy link
Contributor

This PR aims to fix #457.

Briefly, a new label_glue() function is added that uses the glue package to interpolate strings. The only thing users familiar with the glue package should know is that x is the variable that holds the breaks values.

devtools::load_all("~/packages/scales/")
#> ℹ Loading scales
demo_discrete(iris$Species, labels = label_glue("The Iris {x} flower"))
#> scale_x_discrete(labels = label_glue("The Iris {x} flower"))

Created on 2024-10-07 with reprex v2.1.1

@thomasp85 are there some steps to take that will make {marquee} integration more useful?

@teunbrand
Copy link
Contributor Author

Added option to parse the labels to expressions:

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

demo_continuous(c(0, 10), labels = label_glue("'{number(x)}m'^2", parse = TRUE))
#> scale_x_continuous(labels = label_glue("'{number(x)}m'^2", parse = TRUE))

demo_log10(c(1, 1e4), labels = label_glue("10^{log10(x)}", parse = TRUE))
#> scale_x_log10(labels = label_glue("10^{log10(x)}", parse = TRUE))

Created on 2024-10-11 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 this pull request may close these issues.

Feature request: label_glue()
1 participant