想要将患者ID作为标签添加到我的生存情节中。我知道我没有提供源数据,抱歉。但我想,无论如何,我的问题可以解决你聪明的人;-)
library(survival)
s=Surv(data$OS,data$Death.1)~data$Tumordignity
b=survfit(s)
plot(b,
col = c("darkred","darkgoldenrod","darkblue","green3"),
bty = "n",
lwd = 3,
mark.time = TRUE,
main="Overall survival in patients with malignancies",
xlab="survival time...",
ylab = "Survival rate...",
xlim=c(0,2600),
cex.main=0.8)
#so far, so good...
# try to add text to the mark.time-points
text(data$OS,
data$Death.1,
labels = data$ID,
cex= 0.7, pos=3)
问题在于,标签(ID)将绘制在右侧x位置,而不是右侧y位置。 see my plot
如何解决?使用点(x ..)?