Has anyone had issues with sec_axis() in ggplot2 3.5.2?

Post Body:

Hi everyone,

I’m running into an unexpected error when using sec_axis() with ggplot2. I’ve checked the documentation and previous posts, and I couldn’t find anything that explains this behavior. So I’m wondering if anyone else has experienced something similar, or if I might be missing something obvious.

Here’s a minimal reproducible example:

library(ggplot2)

df <- data.frame(x = 1:10, y = (1:10) * 2)

ggplot(df, aes(x = x, y = y)) +
geom_line() +
scale_y_continuous(
name = "Primary Axis",
sec.axis = sec_axis(~ . / 2, name = "Secondary Axis")
)
This gives me the following error:

r

CopiarEditar

Error in train_continuous(x, self$range, call = call) : 
  unused argument (call = call)

I’m using ggplot2 version 3.5.2, freshly installed from CRAN. I’ve also restarted my R session and reinstalled the package, but the error still occurs.

Has anyone seen this before? Any insights would be appreciated!

Thanks in advance.

It is plotting smoothly for me.
Ubuntu 24.04
R version 4.5.0
RStudio 2025.05.0+496
{ggplot} 3.5.2

Is there any chance that you have something in your environment that is clashing with {ggplot2}?

works on my end

sessionInfo()$R.version$version.string
[1] "R version 4.5.0 (2025-04-11)"
RStudio.Version()$long_version
[1] "2025.05.0+496"
sessionInfo()$otherPkgs$ggplot$Version
[1] "3.5.2"
sessionInfo()$running
[1] "macOS Sequoia 15.5"

It also works fine for me.
Confirm with packageVersion("ggplot2") or sessionInfo() that your code is really using version 3.5 (anything lower than 3.3 will probably give this error)