Skip to content

Error in plot@scales: no applicable method for @ applied to an object of class "ggplot2::ggplot" #269

@qomhmd

Description

@qomhmd

I get the error message when running on RStudio Server (2025.09.0 Build 387) with R v4.5.1

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(survival)
library(ggsurvfit)
#> Loading required package: ggplot2

lung <- lung %>%
  mutate(
    status = case_match(
      status,
      1 ~ 0, # censored
      2 ~ 1, # event
    )
  )

survfit2(Surv(time, status) ~ 1, data = lung) |>
  ggsurvfit() +
    labs(
      x = "Days",
      y = "Overall survival probability"
    )
#> Registered S3 methods overwritten by 'backports':
#>   method                    from 
#>   as.character.Rconcordance tools
#>   print.Rconcordance        tools
#> Error in plot@scales: no applicable method for `@` applied to an object of class "ggplot2::ggplot"

Created on 2025-10-07 with reprex v2.1.1

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions