Follow-up Plot | R Documentation |
Plot longitudinal values of individuals with or without stratification
followup.plot(id, time, outcome, by = NULL, n.of.lines = NULL, legend = TRUE, legend.site = "topright", lty = "auto", line.col = "auto", stress = NULL, stress.labels = FALSE, label.col = 1, stress.col = NULL, stress.width = NULL, stress.type = NULL, lwd = 1, xlab, ylab, ...)
id |
idenfication variable of the same subject being followed up |
time |
time at each measurement |
outcome |
continuous outcome variable |
by |
stratification factor (if any) |
n.of.lines |
number of lines (or number of subjects in the data frame) randomly chosen for drawing |
legend |
whether a legend will be automatically included in the graph |
legend.site |
a single character string indicating location of the legend. See details of ?legend |
lty |
type of the "time" lines. See 'lty' in ?par |
line.col |
line colour(s) for non-stratified plot |
stress |
subset of ids to draw stressed lines |
stress.labels |
whether the stressed lines should be labelled |
label.col |
single integer indicating colour of the stressed line labels |
stress.col |
colour values used for the stressed line. Default value is '1' or black |
stress.width |
relative width of the stressed line |
stress.type |
line type code for the stressed line |
lwd |
line width |
xlab |
label for X axis |
ylab |
label for Y axis |
... |
other graphic parameters |
'followup.plot' plots outcome over time of the individual subjects.
If a stratification variable 'by' is specified, the levels of this variable will be used to color the lines.
'n.of.lines' is used to reduce the number of lines to allow the pattern to be seen more clearly.
'legend' is omitted if 'n.of.lines' is not NULL or the number of subjects exceeds 7 without stratification.
'line.col' works only for a non-stratified plot. It can be a single standard colour or "multicolor".
Values for 'stress.col', 'stress.width' and 'stress.type', if not NULL, should follow those for 'col', 'lwd' and 'lty', respectively
Virasakdi Chongsuvivatwong cvirasak@gmail.com
'plot','lines'
.data <- Indometh attach(.data) followup.plot(Subject, time, conc) followup.plot(Subject, time, conc, lty=1:6, line.col=rep("black",6)) detach(.data) .data <- Sitka attach(.data) followup.plot(tree, Time, size) followup.plot(tree, Time, size, line.col = "brown") followup.plot(tree, Time, size, line.col = "multicolor") followup.plot(tree, Time, size, n.of.lines=20, line.col = "multicolor") # Breakdown of color by treatment group followup.plot(tree, Time, size, by=treat) # The number of lines reduced to 40 followup.plot(tree, Time, size, by=treat, n.of.lines=40) # Stress some lines length(table(tree)) # 79 trees followed up # Identifying trees that sometimes became smaller .data <- .data[order(.data$tree, .data$Time),] detach(.data) attach(.data) next.tree <- c(tree[-1], NA) next.size <- c(size[-1], NA) next.size[tree != next.tree] <- NA smaller.trees <- tree[next.size < size] followup.plot (tree, Time, size, line.col=5, stress=smaller.trees, stress.col=2, stress.width=2, stress.type=2) followup.plot (tree, Time, size, line.col=5, stress=smaller.trees, stress.col=2, stress.width=2, stress.type=2, stress.labels=TRUE) detach(.data) rm(list=ls())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.