Skip to content

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

Description

@dereksonderegger

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()`?

Metadata

Metadata

Assignees

No one assigned

    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