In ggplot2, how to transform a scale by "modulus" using a character?

The help for scale_*_continuous suggests that you can just use the name of a transformation object. But sometimes those objects require another argument. In this case, I don't know where to put these arguments or if this is even possible. An example is "modulus" which requires a p argument

library(tidyverse)
library(scales)
#> Warning: package 'scales' was built under R version 4.3.1
#> 
#> Attaching package: 'scales'
#> The following object is masked from 'package:purrr':
#> 
#>     discard
#> The following object is masked from 'package:readr':
#> 
#>     col_factor

pressure |>
  ggplot() +
  geom_point(aes(x = temperature, , 
                 y = pressure)) +
  scale_y_continuous(trans = scales::modulus_trans(p = 0.5))


pressure |>
  ggplot() +
  geom_point(aes(x = temperature, , 
                 y = pressure)) +
  scale_y_continuous(trans = "modulus")
#> Error in match.fun(f)(): argument "p" is missing, with no default

Created on 2023-07-19 with reprex v2.0.2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.