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

Combined facet labels aren't parsed when .multi_line = FALSE #4084

Closed
karawoo opened this issue Jun 23, 2020 · 0 comments · Fixed by #4418
Closed

Combined facet labels aren't parsed when .multi_line = FALSE #4084

karawoo opened this issue Jun 23, 2020 · 0 comments · Fixed by #4418
Labels
bug an unexpected problem or unintended behavior facets 💎
Milestone

Comments

@karawoo
Copy link
Member

karawoo commented Jun 23, 2020

(previously: #4032 (comment))

Facet labels that are combined with .multi_line = FALSE don't show up as parsed when using label_parsed:

library("ggplot2")

dat <- data.frame(x = 1, y = 1, a = "a", b = 1)

ggplot(dat, aes(x, y)) +
  geom_point() +
  facet_grid(
    ~ a + b,
    labeller = labeller(
      a = c("a" = "a^2"),
      .default = label_parsed,
      .multi_line = FALSE
    )
  )

Created on 2020-06-22 by the reprex package (v0.3.0)

Compare to .multi_line = TRUE, which looks as it should:

ggplot(dat, aes(x, y)) +
  geom_point() +
  facet_grid(
    ~ a + b,
    labeller = labeller(
      a = c("a" = "a^2"),
      .default = label_parsed,
      .multi_line = TRUE
    )
  )

One issue is the .multi_line argument doesn't get passed along here:

labellers <- lapply(dots, as_labeller, default = .default)

However changing that line alone makes things worse:

ggplot(dat, aes(x, y)) +
  geom_point() +
  facet_grid(
    ~ a + b,
    labeller = labeller(
      a = c("a" = "a^2"),
      .default = label_parsed,
      .multi_line = FALSE
    )
  )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior facets 💎
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants