Skip to content

Fix label formatting bug in warning #6483

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

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

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #6463.

Briefly, function-labels are formatted as <function> so they don't mess with text formatting.
Example from reprex, note the warning about unknown labels:

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

penguins |> 
  ggplot() +
  geom_histogram(aes(x = flipper_length_mm)) +
  labs(
    x = snakecase::to_sentence_case,
    y = snakecase::to_sentence_case,
    fill = snakecase::to_sentence_case,
  )
#> Warning: Ignoring unknown labels:
#> • fill : <function>
#> `stat_bin()` using `bins = 30`. Pick better value `binwidth`.
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_bin()`).

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

@teunbrand teunbrand added this to the ggplot2 4.0.0 milestone May 28, 2025
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.

Could the new functional way of setting labs be okay when the applicable aesthetic is not present?
1 participant