plot.survfit {survival} | R Documentation |
survfit
objects
A plot of survival curves is produced, one curve for each strata.
The 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).
Curves are plotted in the same order as they are listed by print
(which gives a 1 line summary of each).
This will be the order in which col
, lty
, etc are used.
## S3 method for class 'survfit' plot(x, conf.int=, mark.time=FALSE, 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", conf.times, conf.cap=.005, conf.offset=.012, ...)
x |
an object of class |
conf.int |
determines whether confidence intervals will be plotted. The default is to do so if there is only 1 curve, i.e., no strata. |
mark.time |
controls the labeling of the curves. If set to |
mark |
vector of mark parameters, which will be used to label the curves.
The |
col |
a vector of integers specifying colors for each curve. The default value is 1. |
lty |
a vector of integers specifying line types for each curve. The default value is 1. |
lwd |
a vector of numeric values for line widths. The default value is 1. |
cex |
a numeric value specifying the size of the marks. This is not treated as a vector; all marks have the same size. |
log |
a logical value, if TRUE the y axis wll be on a log scale. Alternately, one of the standard character strings "x", "y", or "xy" can be given to specific logarithmic horizontal and/or vertical axes. |
yscale |
a numeric value used to multiply the labels on the y axis.
A value of 100, for instance, would be used to give a percent scale.
Only the labels are
changed, not the actual plot coordinates, so that adding a curve with
" |
xscale |
a numeric value used like |
firstx, firsty |
the starting point for the survival curves. If either of these is set to
If |
xmax |
the maximum horizontal plot coordinate. This can be used to shrink
the range of a plot. It shortens the curve before plotting it, so
that unlike using the |
ymin |
lower boundary for y values. Survival curves are most often drawn in the
range of 0-1, even if none of the curves approach zero.
The parameter is ignored if the |
fun |
an arbitrary function defining a transformation of the survival curve.
For example |
xlab |
label given to the x-axis. |
ylab |
label given to the y-axis. |
xaxs |
either |
conf.times |
optional vector of times at which to place a confidence bar on the curve(s). If present, these will be used instead of confidence bands. |
conf.cap |
width of the horizontal cap on top of the confidence bars; only used if conf.times is used. A value of 1 is the width of the plot region. |
conf.offset |
the offset for confidence bars, when there are multiple curves on the plot. A value of 1 is the width of the plot region. If this is a single number then each curve's bars are offset by this amount from the prior curve's bars, if it is a vector the values are used directly. |
... |
for future methods |
When the survfit
function creates a multi-state survival curve
the resulting object also has class ‘survfitms’.
Competing risk curves are a common case. The only difference in
the plots is that multi-state defaults to a curve that goes from lower
left to upper right (starting at 0), where survival curves by default
start at 1 and go down. All other options are identical.
When the conf.times
argument is used, the confidence bars are
offset by conf.offset
units to avoid overlap.
The bar on each curve are the confidence interval for the time point
at which the bar is drawn, i.e., different time points for each curve.
If curves are steep at that point, the visual impact can sometimes
substantially differ for positive and negative values of
conf.offset
.
a list with components x
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.
In prior versions the behavior of xscale
and
yscale
differed: the first changed the scale both for the plot
and for all subsequent actions such as adding a legend, whereas yscale
affected only the axis label. This was normalized in version 2-36.4,
and both parameters now only affect the labeling.
points.survfit
,
lines.survfit
,
par
,
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\nfor AML Maintenance Study") lsurv2 <- survfit(Surv(time, status) ~ x, aml, type='fleming') plot(lsurv2, lty=2:3, fun="cumhaz", xlab="Months", ylab="Cumulative Hazard")