EVOLUTION-MANAGER
Edit File: plot.survfit.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Plot method for 'survfit' objects</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for plot.survfit {survival}"><tr><td>plot.survfit {survival}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Plot method for <code>survfit</code> objects </h2> <h3>Description</h3> <p>A plot of survival curves is produced, one curve for each strata. The <code>log=T</code> 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). </p> <p>Curves are plotted in the same order as they are listed by <code>print</code> (which gives a 1 line summary of each). This will be the order in which <code>col</code>, <code>lty</code>, etc are used. </p> <h3>Usage</h3> <pre> ## S3 method for class 'survfit' plot(x, conf.int=, mark.time=FALSE, pch=3, col=1, lty=1, lwd=1, cex=1, log=FALSE, xscale=1, yscale=1, xmax, ymin=0, fun, xlab="", ylab="", xaxs="r", conf.times, conf.cap=.005, conf.offset=.012, mark, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an object of class <code>survfit</code>, usually returned by the <code>survfit</code> function. </p> </td></tr> <tr valign="top"><td><code>conf.int</code></td> <td> <p>determines whether confidence intervals will be plotted. The default is to do so if there is only 1 curve, i.e., no strata. </p> </td></tr> <tr valign="top"><td><code>mark.time</code></td> <td> <p>controls the labeling of the curves. If set to <code>FALSE</code>, no labeling is done. If <code>TRUE</code>, then curves are marked at each censoring time. If <code>mark</code> is a numeric vector then curves are marked at the specified time points. </p> </td></tr> <tr valign="top"><td><code>pch</code></td> <td> <p>vector of characters which will be used to label the curves. The <code>points</code> help file contains examples of the possible marks. A single string such as "abcd" is treated as a vector <code>c("a", "b", "c", "d")</code>. The vector is reused cyclically if it is shorter than the number of curves. If it is present this implies <code>mark.time = TRUE</code>. </p> </td></tr> <tr valign="top"><td><code>col</code></td> <td> <p>a vector of integers specifying colors for each curve. The default value is 1. </p> </td></tr> <tr valign="top"><td><code>lty</code></td> <td> <p>a vector of integers specifying line types for each curve. The default value is 1. </p> </td></tr> <tr valign="top"><td><code>lwd</code></td> <td> <p>a vector of numeric values for line widths. The default value is 1. </p> </td></tr> <tr valign="top"><td><code>cex</code></td> <td> <p>a numeric value specifying the size of the marks. This is not treated as a vector; all marks have the same size. </p> </td></tr> <tr valign="top"><td><code>log</code></td> <td> <p>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. </p> </td></tr> <tr valign="top"><td><code>yscale</code></td> <td> <p>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 "<code>lines(surv.exp(...))</code>", say, will perform as it did without the <code>yscale</code> argument. </p> </td></tr> <tr valign="top"><td><code>xscale</code></td> <td> <p>a numeric value used like <code>yscale</code> for labels on the x axis. A value of 365.25 will give labels in years instead of the original days. </p> </td></tr> <tr valign="top"><td><code>xmax</code></td> <td> <p>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 <code>xlim</code> graphical parameter, warning messages about out of bounds points are not generated. </p> </td></tr> <tr valign="top"><td><code>ymin</code></td> <td> <p>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 <code>fun</code> argument is present, or if it has been set to <code>NA</code>. </p> </td></tr> <tr valign="top"><td><code>fun</code></td> <td> <p>an arbitrary function defining a transformation of the survival curve. For example <code>fun=log</code> is an alternative way to draw a log-survival curve (but with the axis labeled with log(S) values), and <code>fun=sqrt</code> would generate a curve on square root scale. Five often used transformations can be specified with a character argument instead: <code>"S"</code> gives the usual survival curve, <code>"log"</code> is the same as using the <code>log=T</code> option, <code>"event"</code> or <code>"F"</code> plots the empirical CDF <i>F(t)= 1-S(t)</i> (f(y) = 1-y), <code>"cumhaz"</code> plots the cumulative hazard function (f(y) = -log(y)), and <code>"cloglog"</code> creates a complimentary log-log survival plot (f(y) = log(-log(y)) along with log scale for the x-axis). The terms <code>"identity"</code> and <code>"surv"</code> are allowed as synonyms for <code>type="S"</code>. </p> </td></tr> <tr valign="top"><td><code>xlab</code></td> <td> <p>label given to the x-axis. </p> </td></tr> <tr valign="top"><td><code>ylab</code></td> <td> <p>label given to the y-axis. </p> </td></tr> <tr valign="top"><td><code>xaxs</code></td> <td> <p>either <code>"S"</code> for a survival curve or a standard x axis style as listed in <code>par</code>; "r" (regular) is the R default. Survival curves have historically been displayed with the curve touching the y-axis, but not touching the bounding box of the plot on the other 3 sides, Type <code>"S"</code> accomplishes this by manipulating the plot range and then using the <code>"i"</code> style internally. The "S" style is becoming increasingly less common, however. </p> </td></tr> <tr valign="top"><td><code>conf.times</code></td> <td> <p>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.</p> </td></tr> <tr valign="top"><td><code>conf.cap</code></td> <td> <p>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.</p> </td></tr> <tr valign="top"><td><code>conf.offset</code></td> <td> <p>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.</p> </td></tr> <tr valign="top"><td><code>mark</code></td> <td> <p>a historical alias for <code>pch</code></p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>for future methods</p> </td></tr> </table> <h3>Details</h3> <p>When the <code>survfit</code> 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. </p> <p>When the <code>conf.times</code> argument is used, the confidence bars are offset by <code>conf.offset</code> 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 <code>conf.offset</code>. </p> <h3>Value</h3> <p>a list with components <code>x</code> and <code>y</code>, containing the coordinates of the last point on each of the curves (but not the confidence limits). This may be useful for labeling. </p> <h3>Note</h3> <p>In prior versions the behavior of <code>xscale</code> and <code>yscale</code> differed: the first changed the scale both for the plot and for all subsequent actions such as adding a legend, whereas <code>yscale</code> affected only the axis label. This was normalized in version 2-36.4, and both parameters now only affect the labeling. </p> <h3>See Also</h3> <p><code><a href="lines.survfit.html">points.survfit</a></code>, <code><a href="lines.survfit.html">lines.survfit</a></code>, <code><a href="../../graphics/html/par.html">par</a></code>, <code><a href="survfit.html">survfit</a></code> </p> <h3>Examples</h3> <pre> 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") </pre> <hr /><div style="text-align: center;">[Package <em>survival</em> version 2.44-1.1 <a href="00Index.html">Index</a>]</div> </body></html>