log=T
option does extra work to avoid log(0), and to try to create a
pleasing result. If there are zeros, they are plotted by default at
0.8 times the smallest non-zero value on the curve(s).## S3 method for class 'survfit':
plot(x, conf.int=, mark.time=TRUE,
mark=3, col=1, lty=1, lwd=1, cex=1, log=FALSE, xscale=1, yscale=1,
firstx=0, firsty=1, xmax, ymin=0, fun,
xlab="", ylab="", xaxs="S", ...)
survfit
, usually returned by the
survfit
function.FALSE
, no
labeling is done.
If TRUE
, then curves are marked at each censoring time which
is not also a death time. If mark.time
is a
numeric vector, lines
help file contains examples of the possible marks.
The vector is reused cyclically if it is shorter than the number of curves.lines(surv
yscale
for labels on the x axis.
A value of 365.25 will give labels in years instead of the original days.NA
the plot will start at the first time point of the curve.
By default, the plot program obeys tradition by having the plot start at
(0,0).If
xlim
graphical parameter, warning
messages about out of bounds points arefun
argument is present,
or if it has been set to NA
.fun=log
is an alternative way to draw a log-survival curve
(but with the axis labeled with log(S) values),
and fun=sqrt
would gener"S"
for a survival curve or a standard x axis style as
listed in par
.
Survival curves are usually displayed with the curve touching the y-axis,
but not touching the bounding box of the plot on the other 3 sidesx
and y
, containing the coordinates of the last point
on each of the curves (but not the confidence limits).
This may be useful for labeling.coxph
model does not include
the censoring times. Therefore, specifying mark.time=T
does not work.
If you want to mark censoring times on the curve(s) resulting
from a coxph
fit, provide a vector of times as the
mark.time
argument
in the call to plot.survfit
or lines.survfit
.par
,
survfit
,
lines.survfit
.leukemia.surv <- survfit(Surv(time, status) ~ x, data = aml)
plot(leukemia.surv, lty = 2:3)
legend(100, .9, c("Maintenance", "No Maintenance"), lty = 2:3)
title("Kaplan-Meier Curves
for AML Maintenance Study")
lsurv2 <- survfit(Surv(time, status) ~ x, aml, type='fleming')
plot(lsurv2, lty=2:3, fun="cumhaz",
xlab="Months", ylab="Cumulative Hazard")
Run the code above in your browser using DataLab