Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug Report: ggplot2 version 3.5.0 now throws warnings in add_risktable() - "Did you mean to use annotate()?" #191

Open
dereksonderegger opened this issue Mar 4, 2024 · 1 comment

Comments

@dereksonderegger
Copy link

dereksonderegger commented Mar 4, 2024

It seems in the most recent update to ggplot2, there is now a warning thrown if the number of aesthetic attributes doesn't match the number of data rows. This warning now gets generated when add_risktable() is used. The error is most easily confirmed in the current documentation page:

https://www.danieldsjoberg.com/ggsurvfit/reference/add_risktable.html

Below is a quick reproducible example, so long as the calling environment is using ggplot2 version 3.5.0.

packageVersion("ggplot2")

library(ggsurvfit)
result <- survfit2(Surv(time, status) ~ sex, data = df_lung) |>
  ggsurvfit() +
  add_risktable()
result
> packageVersion("ggplot2")
[1] ‘3.5.0’

Warning messages:
1: In ggplot2::geom_blank() :
  All aesthetics have length 1, but the data has 208 rows.
ℹ Did you mean to use `annotate()`?
2: In ggplot2::geom_blank() :
  All aesthetics have length 1, but the data has 208 rows.
ℹ Did you mean to use `annotate()`?
3: In ggplot2::geom_blank() :
  All aesthetics have length 1, but the data has 208 rows.
ℹ Did you mean to use `annotate()`?

@ddsjoberg
Copy link
Collaborator

Ooof, thank you for reporting @dereksonderegger !

@ddsjoberg ddsjoberg mentioned this issue Apr 16, 2024
13 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants