## KAPLAN MEIER
fit.obj<-survfit(Surv(duree_suivi,k_oesogastr) ~ baria_t, data = pts_raw_matched)
library(survminer)
我正在比較兩條曲線。但是事件的數量是如此之少,以至于您無法很好地看到曲線。我想截斷 y 軸(例如在 0.9 和 1 之間)以查看兩條曲線的演變。
n events median 0.95LCL 0.95UCL
baria_t=Sleeve 114221 61 NA NA NA
baria_t=Bypass 114221 58 NA NA NA
ggsurvplot(fit.obj,
conf.int = T,
risk.table ="absolute",
tables.theme = theme_cleantable())
以下是生存曲線:

uj5u.com熱心網友回復:
如果我們使用一些模擬資料,我們可以復制您的問題:
set.seed(1)
pts_raw_matched <- data.frame(
duree_suivi = c(runif(114221, 0, 25000),runif(114221, 0, 26000)),
baria_t = rep(c('Sleeve', 'Bypass'), each = 114221)
)
pts_raw_matched$k_oesogastr <- as.numeric(pts_raw_matched$duree_suivi < 15)
pts_raw_matched$duree_suivi[pts_raw_matched$duree_suivi > 15] <- 15
現在我們應該有一個與您自己的資料具有相同名稱和大致相同特征的資料集。
我們首先使用您自己的代碼創建繪圖,但存盤結果:
fit.obj <- survfit(Surv(duree_suivi,k_oesogastr) ~ baria_t,
data = pts_raw_matched)
ggs <- ggsurvplot(fit.obj,
conf.int = T,
risk.table ="absolute",
tables.theme = theme_cleantable())
ggs

為了改變y軸,我們需要設定物件plot組件的ylim ggs。在這種情況下,我們需要將限制設定在 0.999 和 1 之間,以便能夠正確比較曲線:
ggs$plot <- ggs$plot ylim(c(0.999, 1))
ggs

uj5u.com熱心網友回復:
您可以直接在對 ggsurvplot 的呼叫中添加引數 ylim=c(0.999, 1):
ggsurvplot(fit.obj,
conf.int = T,
risk.table ="absolute",
tables.theme = theme_cleantable(),
ylim=c(0.999, 1))
你可以對 xlim 做同樣的事情
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/521649.html
上一篇:通過向量串列R的名稱創建組變數
