简体   繁体   English

在survminer生存图上添加一行

[英]Add a line to survminer survival plot

I have the following survival curve 我的生存曲线如下

require("survival")
library(survminer)
fit <- survfit(Surv(time, status) ~ 1, data = lung)
ggsurvplot(fit,  palette = "jco",risk.table = TRUE)

I would like to add to the plot the non-straight line with x time=c(0,100, 200, 300, 500, 750) and y surv=c(1, 0.99, 0.95, 0.92, 0.88, 0.82) 我想将x time=c(0,100, 200, 300, 500, 750)和y surv=c(1, 0.99, 0.95, 0.92, 0.88, 0.82) time=c(0,100, 200, 300, 500, 750)的非直线添加到图中

How can I do that? 我怎样才能做到这一点?

I think you're looking for the geom_curve() OR geom_segment() argument - you'll have to specify the type of curve, but it's certainly one option for adding a customized line to your ggplot. 我认为您正在寻找geom_curve()或geom_segment()参数-您必须指定曲线的类型,但这肯定是向ggplot添加自定义线的一种选择。

Here's more: https://ggplot2.tidyverse.org/reference/geom_segment.html 这里是更多: https : //ggplot2.tidyverse.org/reference/geom_segment.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Survminer 的生存图 - 空白图 - Survival Plots with Survminer - Blank Plot 使用 survminer::ggsurvplot 在 r 中以编程方式绘制许多生存曲线的问题 - issues using survminer::ggsurvplot to plot many survival curves programmatically in r 在调整后的生存曲线ggadjustedcurves(survminer,ggplot2)中自定义线型 - Customising line type in adjusted survival curves ggadjustedcurves (survminer, ggplot2) 如何在 survminer (ggforest) 中向森林 plot 添加箭头 - How to add arrows to forest plot in survminer (ggforest) 在 r 中使用 survminer package 将风险表和 95% 置信区间添加到调整后的生存曲线 - Add at risk table and 95% confidence intervals to adjusted survival curves using survminer package in r 将中值生存线添加到ggsurvplot - Add median survival line to ggsurvplot Survminer - 在 plot 中包含变量子集 - Survminer - include subset of variables in plot R Survminer Pairwise Survival difference 变长错误 - R Survminer Pairwise Survival difference Variable length error 在 R Studio 中,当我添加截距线时,我的风险表会从我的生存图中删除。 有没有办法克服这个问题? - In R Studio my risk table is removed from my survival plot when I add an intercept line. Is there any way to overcome this issue? 如何使用风险表 (R) 为生存 plot 添加垂直线和注释 - How to add vertical lines and annotation to survival plot with risk table (R)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM