简体   繁体   中英

Adjusting frequency of x-axis tickmarks in ggsurvplot

I am trying to increase the frequency of x-axis tickmarks in the ggsurvplot function from the package ggplot2 in R 3.5.1 using the argument xticks.by . But no matter what I input the tickmarks frequency stays the same. Adjusting y-axis tickmarks with the yticks.by argument seems to work.

Example code:

library(survival)
library(survminer)

data(ovarian)
data.frame(ovarian)

surv_object <- Surv(time = ovarian$futime, event = ovarian$fustat)
fit1 <- survfit(surv_object ~ rx, data = ovarian)
ggsurvplot(fit1, data = ovarian, xticks.by = 150)

Runnig this code gives the following plot witht he default x-axis tickmarks (300): Survival plot

What am I doing wrong?

你应该使用 break.time.by

ggsurvplot(fit1, data = ovarian, break.time.by = 150)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM