Skip to content

Tests in pillar fail with the dev version of ggplot2 #6361

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

Closed
krlmlr opened this issue Mar 13, 2025 · 3 comments · Fixed by r-lib/pillar#729
Closed

Tests in pillar fail with the dev version of ggplot2 #6361

krlmlr opened this issue Mar 13, 2025 · 3 comments · Fixed by r-lib/pillar#729
Labels
bug an unexpected problem or unintended behavior scales 🐍

Comments

@krlmlr
Copy link
Member

krlmlr commented Mar 13, 2025

Is this us? Should ggplot2 do things differently? Should we investigate further?

This is with the dev version of ggplot2.

library(pillar)

data <- tibble::tibble(
  x = num((1:10) / 100, fixed_exponent = -3, notation = "eng"),
  y = num((1:10) / 100, scale = 100, label = "%"),
  z = num(10^(-5:4), notation = "si")
)

basic <-
  ggplot2::ggplot(data, ggplot2::aes(x, y)) +
  ggplot2::geom_point() +
  ggplot2::theme_minimal(36)

basic
#> Error in make_title(..., self = self): unused arguments (list(), "x")

log_scale <-
  ggplot2::ggplot(data, ggplot2::aes(x, z)) +
  ggplot2::geom_point() +
  scale_y_num(transform = "log10") +
  ggplot2::theme_minimal(36)

log_scale
#> Error in make_title(..., self = self): unused arguments (list(), "x")

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

@teunbrand
Copy link
Collaborator

teunbrand commented Mar 13, 2025

I think this might be a regression due to #6200 and a custom make_title() method in pillar (https://github.com/r-lib/pillar/blob/6a3c8ee066495dfd5543bf5a3ffd61c76897b9dd/R/ggplot2.R#L68).
We might need to try to be backwards compatible in ggplot2.

@teunbrand teunbrand added bug an unexpected problem or unintended behavior scales 🐍 labels Mar 13, 2025
@krlmlr
Copy link
Member Author

krlmlr commented Mar 16, 2025

Is there a way for pillar to be forward-compatible instead?

@teunbrand
Copy link
Collaborator

teunbrand commented Mar 16, 2025

In the upcoming version, the name argument will accept functions that receive the default title and return formatted titles. From eyeballing the pillar method, it might be possible to capture the additional formatting in a separate function that can be given to the name argument. If that is feasible, then it might be possible to avoid having to implement a make_title() method. It might be a bit of a pain to bridge different ggplot2 versions though.

EDIT: nevermind, found a simpler solution which I've put in r-lib/pillar#729.

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 scales 🐍
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants