Skip to content

Conversation

yutannihilation
Copy link
Member

Fix #6617

This function size0 was introduced in #6076 and I guess the expression labels don't work since then. Reading #6076, I found there's no intention to drop support for expression labels, so I think this fixes the problem. (As I don't actively follow the recent development of ggplot2, sorry if I'm missing some discussion)

library(tibble)
devtools::load_all("~/GitHub/ggplot2/")
#> ℹ Loading ggplot2
#> Overwriting method +(<ggplot2::ggplot>, <ANY>)
#> 
#> Overwriting method +(<ggplot2::theme>, <ANY>)
#> 
#> Overwriting method convert(<ggplot2::ggplot>, <list>)

ggplot(tibble(x = -10:10, y = x^2)) +
  geom_point(aes(x, y)) +
  scale_x_continuous(
    breaks = seq(-10, 10, 2),
    labels = parse(text = paste0(seq(-10, 10, 2), "^degree"))
  )

Created on 2025-09-21 with reprex v2.1.1

@yutannihilation yutannihilation changed the title Fix/issue 6617 expression labels Allow expression labels in scale_{x,y}_*() Sep 21, 2025
Copy link
Collaborator

@teunbrand teunbrand left a comment

Choose a reason for hiding this comment

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

Great, thank you! If you want we could add a news bullet to indicate the issue is fixed.

@yutannihilation
Copy link
Member Author

Thanks! Added a news bullet.

@teunbrand
Copy link
Collaborator

Thanks! I'd be happy to merge it, but you can also do this yourself I believe

@yutannihilation
Copy link
Member Author

Then, I'm merging. Thanks for reviewing!

@yutannihilation yutannihilation merged commit 913e63a into tidyverse:main Sep 21, 2025
13 checks passed
@yutannihilation yutannihilation deleted the fix/issue-6617-expression-labels branch September 21, 2025 23:03
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.

ggplot2 problem whe using parse() in scale_x_continuous(labels = ...) throws error despite matching label/break lengths

2 participants